https://kotlinlang.org logo
#getting-started
Title
# getting-started
d

dimsuz

07/19/2022, 4:30 PM
Why does this
Copy code
if (true) 1 else if (false) { 2 } else { 3 }.also { println("hello") }
if (true) 1 else { 3 }.also { println("world") }
print only "world" and not "hello"? first one treats whole if/else as an expression why the latter one treats only else branch as an expression?
d

dimsuz

07/19/2022, 4:38 PM
Thanks!