Previous: , Up: The For Statement   [Index]


7.3.5 The Leave Clause

An early exit clause may follow the expression introducing the traversed collection, with a semicolon separating the two. The clause is (like the ‘while’ loop clause) a continuation condition (and not a stop one), with the traversal loop breaking when the test fails.

for (, text a in list("a", "b", "c", "d"); a < "d") {
    o_(a, "\n");
}

outputs:

a
b
c