Answer the question
In order to leave comments, you need to log in
Why did the code from the official kotlin documentation give this example?
val c: Int // Type required when no initializer is provided
c = 3 // deferred assignment
Answer the question
In order to leave comments, you need to log in
This is true for class fields, but not for local variables. Local variables can be initialized separately from the declaration. The compiler will make sure that this is done before the first call to it
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question