until

Returns a range from this value up to but excluding the specified to value.

infix fun Int.until(to: Byte): IntRange(source)
fun main() {
    val max: Byte = 5
    for (i in 0 until max) {
        println(i)
    }
}

Source