Tsallaka zuwa abun ciki
Justice Tech School

Basic Types

Int, Long, Double, Float, Boolean, Char and String. There are no primitives in your code, the compiler optimises them.

Example
val i: Int = 7
val l = 10_000_000_000L
val d = 2.5
val f = 1.5f
val c = 'K'
println("$i $l $d $f $c ${i::class.simpleName}")

Exercise

Long literal.

val big = 5

Quiz Test

Which type is the default for 2.5?

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