while
FORMULA

The while statement is used at the end of a loop, and can control how many times the loop is executed.


Parameters

This statement has one parameter:

formula – is a formula that should result in a true (–1) or false (0) answer. Usually the formula is created with a combination of comparison operators (=, <>, etc.) and Boolean operators (and, or, etc.) For example the formula Last="Smith" will be true if the field or variables Last contains the value Smith, and false if it contains any other value.

An alternate option for this parameter is the keyword FOREVER. If this keyword is used, the loop will repeat forever unless a StopLoopIf statement exits the loop.


Description

The while statement is used at the end of a loop (see the Loop statement). Unlike the endloop statement, the while statement makes a decision whether to jump back up to the top of the loop, or to continue with the next statement after the loop. The formula in the while statement is evaluated each time Panorama reaches the end of the loop. Panorama will continue looping as long as the result of the formula remains true. If the result of the formula is false, the loop stops and the procedure continues with the next statement after the while statement.

This example adds 10 new records to the current database.

local NewCount
NewCount=10
loop
    NewCount=NewCount-1
    addrecord
while NewCount>0

Error Messages

WHILE does not have a matching LOOP statement


See Also


History

VersionStatusNotes
10.0No ChangeCarried over from Panorama 6.0.