streetsofboston
02/15/2019, 5:56 PMif
, when
, try
expressions in Kotlin, but not in Java).
What was the reason that the assignment operator =
is not an expression?ilya.gorbunov
02/15/2019, 6:04 PM=
is used in named arguments syntax:
foo(arg = value)
This is a call of foo
with arg
argument, rather than a call of foo
with the result of assignment of value
to some arg
variable/property.streetsofboston
02/15/2019, 6:15 PM(value++)
would exactly be such an expression 🙂ghedeon
02/15/2019, 6:26 PMkarelpeeters
02/15/2019, 7:08 PM== true
anyway. You can compare two booleans but that's even more rare.ilya.gorbunov
02/15/2019, 9:59 PMalso
function:
foo(value.also { someVar = it })