Next: , Previous: Decisions, Up: Syntax


3.1.8 Loops

Kite has two types of loops: while and until. while loops execute code while the condition evaluates to true, while until loops execute code until the condition evaluates to true:

     i = 0;
     while (i < 10) [
         i = i + 1;
     ];
     until (i == 0) [
         i = i - 1;
     ];

To break out of the loop early, use the break statement. To jump back to the top of the loop, use continue.