Mangat Rai Modi
1 min readOct 4, 2018

--

Another solution could be to pass statement as lambda arguments to a function. It will be converted to an expression e.g. -

exhaustive {
when (result.type) {
...
}
}
}

fun <T> exhaustive(func: () -> T) {
func()
}

--

--

Mangat Rai Modi
Mangat Rai Modi

Written by Mangat Rai Modi

mangatmodi.com | High scalable services, Low latency coding, and Concurrency! Get’s excited by any tough problem.

No responses yet