Control flow

Loops

Three ways to repeat yourself, plus continue and break for when you change your mind mid-sentence.

while

Repeat while a condition stays true. You must update that condition, or she will never leave.

define num x is 0;
while x lessthan 5;
    showln x;
    redefine x is x + 1;
end;

Reference: while.

for

Header: initializer, condition, step. Three parts, commas, parentheses. A little more formal.

for(define num i is 0, i lessthan 5, redefine i is i + 1);
    showln i;
end;

Reference: for.

forevery

Walk an array. Declare the item, then point at the array with within.

define str[] names is ["Ahsoka", "Yoda", "Kenobi"];
forevery(define str name within names);
    showln name;
end;

References: forevery, within.

continue and break

forevery(define num value within history);
    if value lessthan 50;
        continue;
    end;
    showln value;
end;

for(define num i is 0, i lessthan 10, redefine i is i + 1);
    if i sameas 5;
        break;
    end;
    showln i;
end;