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

Loops

From FenixWiki

(Difference between revisions)
Jump to: navigation, search
Revision as of 15:26, 1 May 2007 (edit)
FCR (Talk | contribs)
m
← Previous diff
Revision as of 15:27, 1 May 2007 (edit) (undo)
FCR (Talk | contribs)

Next diff →
Line 1: Line 1:
[[category:reserved]] [[category:reserved]]
- 
== Definition == == Definition ==
'''LOOP''' '''LOOP'''

Revision as of 15:27, 1 May 2007

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, 
                //meaning 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