https://kotlinlang.org logo
#feed
Title
# feed
v

voddan

11/28/2017, 8:23 AM
Why use
apply
in cases like
takeIf { status }?.apply { doThis() }
? I mean, you don't use the modified
this
, and you don't apply anything to anything. You just run some code. Like
takeIf { status }?.run { doThis() }
😉
d

diego-gomez-olvera

11/28/2017, 8:41 AM
I prefer to use regular
if
for immutable `val`as it is more readable for newcomers to Kotlin
👍 1
2 Views