Tsallaka zuwa abun ciki
Justice Tech School

Kotlin Data Types

Numbers are Int, Long, Double and Float. Others: Boolean, Char and String. There are no implicit conversions, so use toInt(), toDouble() and so on.

Example
val i: Int = 42
val l: Long = 10_000_000_000L
val d = 3.5
val c = 'K'
val ok = true
println(i.toDouble() + d)
println("${i is Int} $c $ok")

Exercise

Convert to Double.

n.()

Quiz Test

Does Kotlin convert Int to Double automatically?

These free lessons are for learning. Join a full course for projects, mentor feedback and a verified certificate.