Cicada’s for loop is simpler and offers less control than C’s. Here is an example showing the syntax.
counter :: int
for counter in <1, 10-counter> print(counter, " ")
Notice that we had to define the loop variable before the loop, as either an int or a double. The loop itself will print the numbers 1 through 5; when counter reaches 6 it will be greater than 10-counter and the loop will stop.
As always, we can break a loop over two lines using a ‘&’, and we can group several lines of code using parentheses beginning on the line of the for command. So we could have rewritten our code above in several different ways.
counter :: int
for counter in <1, 10-counter> &
print(counter, " ")
for counter in <1, 10-counter> (
print(counter)
print(" ")
)
There is no step argument to control the increment of the counter variable, due to limitations of the compiler. If we need a non-1 step we have to use a while loop instead:
counter := 1
while counter <= 10-counter do (
print(counter, " ")
counter = that + 2
)
Last update: November 12, 2025