This wiki is out of date, use the continuation of this wiki instead

Loops

From FenixWiki

Revision as of 15:25, 1 May 2007 by FCR (Talk | contribs)
Jump to: navigation, search


Definition

LOOP

Loop is a reserved word used to create iterations in your code. The terminator for a loop is end. the statements between these words will get repeated indefinately. There are several types of loops:

Example

Process loops()
Private
    var1 = 999;
    var2 = 999;
    var3 = 999;
    var4 = 999;
Begin
    var1 = 0;
    while(var1 <= 10)
        var1++; //this statement will be processed 10 times
    end
    var2 = 0;
    repeat
        var2++; //this does exactly the same but the check is at the end of the loop, thus this loop will be processed at least once!
    until(var2 > 10)
    for(var3 = 0;var3 <= 10;var3++)
        //this does exactly the same as the while loop but you control the incremention in the header of the loop which makes it more readable
    end
    from var4 = 0 to 10 step 1
       //this does exactly the same as the while and the for loop. The '''step 1''' is optional
    end
    loop
        frame; //the frame statement will be processed forever
    end
End
Personal tools