Explore Library
KotlinIntroduction & Core Concepts

50 items

Code QuizBeginner

Inclusive vs exclusive ranges

Notice how 'until' excludes the upper bound.

Codekotlin
fun main() {
    // Intended to print 1 through 5 inclusive
    for (i in 1 until 5) {
        println(i)
    }
}

What is the bug in this code?