Actions
  WHILE in Scol » History » Revision 2
      « Previous |
    Revision 2/3
      (diff)
      | Next »
    
    iri, 09/24/2012 11:59 PM 
    
    
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 13 years ago · 3 revisions