Skip to content

Instantly share code, notes, and snippets.

@mayuroks
Created August 23, 2018 15:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mayuroks/57cee163290235c58126ef6f89e68785 to your computer and use it in GitHub Desktop.
Save mayuroks/57cee163290235c58126ef6f89e68785 to your computer and use it in GitHub Desktop.
Kotlin variables
// 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