Improve Kotlin variables explanation

This commit is contained in:
Andrew 2023-10-31 19:33:28 +10:30 committed by GitHub
commit 08331fe00f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -26,7 +26,7 @@ any parameters.
*/ */
fun main(args: Array<String>) { fun main(args: Array<String>) {
/* /*
Declaring values is done using either "var" or "val". Declaring variables is done using either "var" or "val".
"val" declarations cannot be reassigned, whereas "vars" can. "val" declarations cannot be reassigned, whereas "vars" can.
*/ */
val fooVal = 10 // we cannot later reassign fooVal to something else val fooVal = 10 // we cannot later reassign fooVal to something else