added val and var (#31647)

This commit is contained in:
Rayhan Hanaputra
2019-04-15 17:11:13 +07:00
committed by The Coding Aviator
parent 3d358802b8
commit ef8fbbc544

View File

@ -21,8 +21,8 @@ val lastName = "Musk"
In addition, notice the usage of `val` variable type, here is how it behaves In addition, notice the usage of `val` variable type, here is how it behaves
```kotlin ```kotlin
firstName = "Mark" // can be changed var firstName = "Mark" // can be changed
lastName = "Zuckerberg" // cannot be changed val lastName = "Zuckerberg" // cannot be changed
lastName = 12 // Error: type mismatch lastName = 12 // Error: type mismatch
``` ```