- This wiki is out of date, use the continuation of this wiki instead
Loops
From FenixWiki
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:
- the normal loop
- while loop (terminator: end)
- repeat loop (terminator: until)
- for loop (terminator: end)
- from loop (terminator: end)
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