Meet the Kotlin Programming Language

Apr 10 2024 · Kotlin 1.9, Android 14, Android Studio Hedgehog

Lesson 02: Working with Types

Demo

Episode complete

Play next episode

Next

Heads up... You’re accessing parts of this content for free, with some sections shown as obfuscated text.

Heads up... You’re accessing parts of this content for free, with some sections shown as obfuscated text.

Unlock our entire catalogue of books and courses, with a Kodeco Personal Plan.

Unlock now

Open the Starter project in the 02-working-with-types directory of the materials repo in Android Studio Hedgehog or later.

val age: Int = 28
println("I am $age years old!")
val peopleOnEarth: Long = 8000000000
val fraction: Float = 0.5F
println("Fraction 1/2 is = $fraction")
val pi: Double = 3.1428571429
println("Pi is = $pi")
val earthIsFlat: Boolean = false
println("It is $earthIsFlat that the earth is flat")

val marsIsRed: Boolean = true
println("It is $marsIsRed that Mars is red")
val character: Char = 'A'
println("First letter of the alphabet is $character")
val name: String = "John"
println("My name is $name")
val fruits: Array<String> = arrayOf("Apple", "Banana", "Orange")
println("I like ${fruits[0]}s")
var message: String? = "Hello"
println(message)
message = null
println(message)
val theAnswer = 42
println("The answer to life, universe and everything is $theAnswer")
See forum comments
Cinema mode Download course materials from Github
Previous: Instruction Next: Conclusion