Can anyone give a link to the docs where this synt...
# getting-started
v
Can anyone give a link to the docs where this syntax is described? Can't find it here - https://kotlinlang.org/docs/reference/typecasts.html I mean how "other" is smart-casted in place, not assigned to another var.
w
Isn't the case where if it fails will throw an Exception? So it understands that if it passes after that statement, it smart-cast it?
v
Yep, I think it is. But there is an assignment in the docs. I met this one without assignment and was curious why this is not documented
k
I don’t think that there is an explicit site about this, but
other as MessageModel
is an expression like
other
itself. Any expression can be written top-level within a function. The value of the expression will simply be dismissed. If you were to only write
other
it would compile but IDEA would hint that the expression is pointless.
v
Thanks, Iven