Loops

There are seven kinds of loops in Kedr.

Numeric

for i = 1 to 10 do
    pritnln i
    
# 1, 2, ..., 10        
for i = 1 until 10 do
    println i
    
# 1, 2, ..., 9    
for i = 10 downto 1 step 2 do
    println i
    
# 10, 8, ..., 2

step is available for the first two loops as well.

Enumerator

for i in numbers do
    println i

Infinite

repeat
    i += 1
    if i >= 10 then
        break

Can only end through break or return.

Conditional

while i < 10 do
    i += 1
repeat
    i += 1
until i == 10

repeat until executes the body at least once.

Operations

continue skips the remaining statements and begins the next iteration, break exits the loop immediately.