https://kotlinlang.org logo
Title
f

Florian

06/21/2019, 8:26 PM
In Kotlin, can every expression (theoretically) be used as a standalone statement? Java doesn't allow putting 1 + 1; into a line but in Kotlin that works
d

Dominaezzz

06/21/2019, 8:29 PM
Yes! Almost everything is an expression except
=
.
f

Florian

06/21/2019, 8:43 PM
Thanks, but what I actually mean is can every expression be a statement
it looks so to me
In Java you can't just put 1 + 1; into its own line but in Kotlin this is possible (altough useles)
d

Dominaezzz

06/21/2019, 8:44 PM
I was trying to say that the things you probably think are statements are expressions.
But the answer is Yes.
f

Florian

06/21/2019, 8:55 PM
thanks