repeat and switch
repeat loops until break. switch picks by value.
Example
i <- 0
repeat { i <- i + 1; if (i >= 3) break }
print(i)
f <- function(x) switch(x, a = "first", b = "second", "other")
print(f("a")); print(f("z"))Exercise
Infinite loop.
{ break }Quiz Test
These free lessons are for learning. Join a full course for projects, mentor feedback and a verified certificate.