Looping with the  WHILE  Keyword

Navigation:  Appendices > Macro Language > Instructions > Looping Instructions >

Looping with the  WHILE  Keyword

Previous pageReturn to chapter overviewNext page

The while loop is used to repeat a block of instructions until a certain condition is true.

 

Before the block to be repeated, place a while statement containing the boolean expression that determines if the loop will be performed.

 

while SomeBooleanExpressionIsTrue

 // do something

endwhile

 

The whole point of the while loop is to re-evaluate a condition prior to every loop (which means that if the condition is false from the beginning, the loop will never be entered). Recall that the elements of a for loop could not be modified in the loop, nor could they vary, but in the case of a while loop the following is allowed and often used.

 

while WeekDayOf(nDate) <> 6

 inc(nDate)

endwhile

 

To interrupt the flow of a while loop, use the break or continue commands.


Topic 105132 updated on 01-Nov-2016.
Topic URL: http://www.qppstudio.net/webhelp/index.html?loopingwiththewhilekeyword.htm