App.kt 511 Bytes
Newer Older
Eduard Luhtonen's avatar
Eduard Luhtonen committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
fun main() {
    println("Pow!")

    var x = 1
    println("Before the loop. x = $x")
    while (x < 4) {
        println("In the loop. x = $x")
        x += 1
    }
    println("After the loop. x = $x")

    val y = 1
    if (x > y) {
        println("x is greater than y")
    } else {
        println("x is not greater than y")
    }
    println("This line runs no matter what")

    // NOTE: in this case else must be included
    println(if (x < y) "y is greater than x" else "y is not greater than x")
}