Menu
Coddy logo textTech

Recap - Initialize Variables

Part of the Fundamentals section of Coddy's Kotlin journey. Lesson 11 of 93.

challenge icon

Challenge

Beginner

Write code that initializes the following values:

  • k with the value 88 (note: lowercase 'k')
  • PI with the value 3.14 (note: uppercase 'PI')
  • name with the value "Bob"

Make sure you use the exact variable names and values. Remember:

  • Kotlin is case sensitive! (kK)
  • String values must be enclosed in double quotes: "Bob" not Bob
  • Use val to declare read-only values
  • Put your statements inside the provided fun main() { }

Try it yourself

fun main() {
    // Type your code below


    // Don't change the lines below
    println("k = $k")
    println("PI = $PI")
    println("name = $name")
}

All lessons in Fundamentals

Practice on your own: Kotlin playground