cedric
06/12/2017, 4:33 PMif
diego-gomez-olvera
06/12/2017, 4:36 PMlet
is good for var
, which must generally be avoided but it is needed sometimes.cedric
06/12/2017, 4:38 PMdiego-gomez-olvera
06/12/2017, 4:40 PMvar
can change, and let
extracts a local constant value (it
). I just saw in the comments the one from ‘Justin Lee’, which gives the same reasoncedric
06/12/2017, 4:40 PMtrevjones
06/12/2017, 4:42 PMit
and avoid renaming can’t you just shadow it? thing?.let { thing -> thing.doStuff() }
cedric
06/12/2017, 4:43 PMT?
to T
, so purists might give this infraction a passtrevjones
06/12/2017, 4:45 PMcedric
06/12/2017, 4:47 PMelse
with statefulness (nor that statefulness is necessarily bad) but I do agree that the absence of a let
is suspicious in my blog postroberto.guerra
06/12/2017, 5:14 PMif
also. I find it much more readable in the long run when I go back to read the code.crpr
06/12/2017, 6:02 PMDaniel
06/12/2017, 7:19 PMnullable?.let { doSomethingNotNull(it) } ?: doSomesingElse()
Is the construct for the else branch in Kotlin if i am not mistaken