Siva
07/03/2018, 3:46 PMfun start(code : String) {
val config = service.getConfig(code)
if( config == null ) {
return
}
// do actual biz logic based on config.
}
functional style
fun start(code : String) {
val eitherConfig = service.getConfig(code)
when(eitherConfig) {
is Either.Left -> return
}
val config = either.b
// do actual biz logic based on config.
}
doubt: i am not sure how to break function when Right condition occurs and return it. or continue function with right flow.