Created
August 23, 2018 15:46
-
-
Save mayuroks/57cee163290235c58126ef6f89e68785 to your computer and use it in GitHub Desktop.
Kotlin variables
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Use var to declare a variable, whose value can be changed later | |
var b: String = "Wow" | |
// val in Kotlin is same as final in Java | |
val a: Int = 0 | |
// To initialize a variable as null | |
var c: String? = null | |
// Initialize a variable later in the code using lateInit | |
lateinit var d : MyCustomClass | |
lateinit var items: ArrayList<String> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment