Where should I use var and where val ?
Where should I use var and where val ?
Here's a concise answer to your Kotlin interview question:
var
and val
in KotlinIn Kotlin, you should use:
val
(value) for variables that are immutable and don't change their value after initialization.var
(variable) for mutable variables that can be reassigned a new value during the program's execution.val
when:var
when:junior
Gợi ý câu hỏi phỏng vấn
Chưa có bình luận nào