20

While getting a pro in Kotlin, I started using

when(condition) {
true -> doOneThing()
false -> {
xyz = whatEver()
blaBla()
}
}

instead of simple if-else.
It looks nice but also distracting.

What is your opinion on that?
I guess most will be like:

Comments
  • 0
    @Flarp Nice. 👍🏼 Just like in Kotlin. Do you also tend to use it instead of if-else?
  • 2
    When's are nice but you are switch-caseing a Boolean DONT EVER DO THAT AGAIN
  • 0
    So much Functional. It remember me the match with F# syntax.
    So beauty.... But for some things really "meh, i'm losing time"
  • 0
    @needToRoll That is what I meant. Damn myself 😶
  • 2
    if (x != !true)
    {
    do (thing)
    }
  • 1
    more readability in my opinion.
    nothing wrong, use what suit u best xD
    (unless there is a syntax standard in that project.)
Add Comment