Ben
04/08/2020, 10:54 AMif (getFoo() != null && barEnabled()) {
doSomething();
}
In Kotlin I could write
getFoo().takeIf { barEnabled() }?.let { doSomething() }
but I'm not convinced that's any easier to read, mostly because of the separation between the nullable getFoo() and the let. Any recommendations on how best to write that in Kotlin? Is using scope functions always preferred?diesieben07
04/08/2020, 11:07 AMJohannes Zick
04/08/2020, 11:08 AMBen
04/08/2020, 11:21 AM