Leon K
02/17/2020, 11:56 AM?:
is the elvis-operator, which says "take the nullable thing on the left if it's non-null, but use the right thing if it is null."
in this case , as return
is an expressing returning Nothing
, you can use it in that place and return from your function if the left part is null.
this is kinda confusing, if you don't understand the idea of the Nothing
type and throw
& return
being expressions, so if your'e interested, i'd recommend looking up some kotlinConf talk about kotlins type hierarchy and the Nothing
type. It's extremely practical once you understand it