Image bm157.GIF Image bm158.GIF Repeating of Commands
Program Control
 
Image bm157.GIF heading of conditional repetition
Image bm173.GIF condition test of conditional repetition
Image bm174.GIF commands of conditional repetition
 
The repeating of commands serves a repeated execution of a command group. The first type of repetition is the conditional repetition. In the repetition condition test the logic term quoted there is tested before each pass of the repetition cycle. If the term is fulfilled, the cycle commands will be executed. In the opposite case the program keeps on running, carrying out further commands following the cycle. This means that if the condition is not satisfied, the commands may not be carried out even a single time.
 
Image bm158.GIF heading of an iterative repetition
Image bm175.GIF repetition count
Image bm174.GIF commands of an iterative repetition
 
The second repetition type is repetition with specified run number (iterative repetition). In this type a numeric term in the repetition count specifies the number saying how many times the commands should be carried out. The value of the term specifying the repetition count is rounded up to the nearest integer number and transferred to the absolute value. This means that for the term value ranging between -0.5 < n < 0.5  the cycle commands will not be carried out even a single time.
 
Image bm159.GIF repetition interrupt (break executing)
 
The repetition interrupt command serves to finish the repetition prematurely. It is a command, which can be entered anywhere among the commands of the conditional repetition or the iterative repetition. During the execution of this command the highest running cycle is interrupted. If there is no running super-ordinate cycle in the function, the command execution is concluded like the command for concluding the function (function termination). No flag of the repetition interrupt will be transferred out of the function.
 
Examples of using:
 
Image bm176.GIF Image bm177.GIF

Full Html Context Help of The Peter - Gemtree Software & Children Programming