The loop statement is used at the beginning of a loop.
Parameters
No parameters.
Description
The loop statement is used at the beginning of a loop. A loop is a sequence of statements that are executed over and over again. The end of the loop is always an endloop, until or while statement.
Loops are one of the fundamental building blocks of programming. In Panorama all loops begin with a loop statement and end with either an endloop, until or while statement. The statements in between the top and bottom of the loop are said to be inside the loop. These are the statements that will be repeated over and over again. Although it is not required, your procedures will usually be easier to read and understand if the statements inside the loop are indented. It is possible to put one loop inside of another. This is called a nested loop.
This simple example adds 10 new records to the current database.
loop
addrecord
until 10
This example prints all unprinted records using the appropriate form. In this case the loop can only stop at the top (because of the stoploopif), because the endloop statement will loop forever!
find PrintedStatus=""
loop
stoploopif (not info("found"))
openform PrintForm
print ""
PrintedStatus="Complete"
closewindow
nextmatch
endloop
Error Messages
LOOP without ENDLOOP – Each LOOP statement must be paired with a corresponding ENDLOOP, UNTIL or WHILE statement. If this error message appears, the necessary statement terminating the loop has not been included.
See Also
History
Version | Status | Notes |
10.0 | No Change | Carried over from Panorama 6.0. |