Join Slack
Powered by
If I know a value is null initially but won’t be n...
# getting-started
v
voben
04/29/2020, 2:17 AM
If I know a value is null initially but won’t be null when accessed. Is it preferred to
!!
?.
s
sttimchenko
04/29/2020, 2:23 AM
It’s better to use
?.
as this construct does exactly what it should - helps to avoid unexpected NPE.
i
ilya.gorbunov
04/29/2020, 3:03 AM
You can declare it as
lateinit var
with non-nullable type.
➕ 9
4
Views
Open in Slack
Previous
Next