`lateinit var a: String` makes it possible to have...
# announcements
m
lateinit var a: String
makes it possible to have non-nullable type and yet allow for this edge case of it being null until properly assigned value AFTER construction
l
maciekjanusz: But using
var a = 0
can work too, avoiding autoboxing
m
that's beside the point of
lateinit
, you cannot use
lateinit
on properties with initializer
also, I have to correct my example, one cannot use
lateinit
with primitives also
l
More accurately
lateinit
would be pointless if first init is not late, but in the initializer instead 😉