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()
}