Foundations
Variables
Variables store values that expressions can reuse.
Variables
Variables.kt
fun main() {
val unitPrice =
val quantity = 3
val total = unitPrice * quantity
println("unit=$unitPrice")
println("total=$total")
}
fun main() {
val unitPrice =
val quantity = 3
val total = unitPrice * quantity
println("unit=$unitPrice")
println("total=$total")
}
fun main() {
val unitPrice =
val quantity = 3
val total = unitPrice * quantity
println("unit=$unitPrice")
println("total=$total")
}
val
Use `val` for a read-only local value.