What's the difference?
Kotlin provides two ways to define variables:
var. What's the difference? You can change
var variables as many times as you want. But once you set a
val variable, you can't update again. Here's an example:
val firstName = "Daniel" // always stuck with "Daniel", can't change anymore
From now on, you can't change
firstName; it's set in stone. However, had I created
var, I can change it:
var firstName = "Daniel" firstName = "Dan" firstName = "John" firstName = "Don"
In general, prefer
val, unless the variables needs to change.
Build a simple contacts manager.
Create beautiful buttons in XML.
Built with Android Studio and Kotlin.
Getting started is sometimes the hardest part.
Add a click listener in Kotlin.
Let users sign in.