Project

General

Profile

Actions

WHILE in Scol

while <condition> do instructions

while <condition> do
(
    instruction_1;
    instruction_2;
    instruction_3;

    instruction_n;
);

If the condition is false at the start, the instructions block is never ran.

Example :

fun main ()=
    _showconsole;

    let 10 -> counter in
    while (counter >= 0) do
    (
        _fooId counter;
        // do not forget to increase or decrease your counter, otherwise, the loop can become infinite
        set counter = counter-1
    );
    0;;

License : CC-BY-SA-2.0
Tutorial by iri
Updated by /

Updated by iri about 12 years ago · 3 revisions