The loop statement is used at the beginning of a loop.
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.
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!
stoploopif (not info("found"))
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.
- endloop -- is used at the end of a loop.
- for -- is used at the beginning of a loop that loops a fixed number of times.
- info("timelimitremaining") -- returns the amount of time available (in seconds) before a loop will time out.
- looparray -- is used at the beginning of a loop that loops over the elements of an array.
- loopdataarray -- is used at the beginning of a loop that loops over the elements of a data array.
- loopindex -- allows a procedure to determine how many times a loop has been repeated.
- loopwhile -- is used at the beginning of a loop.
- Preventing Endless Loops -- setting up a timeout limit to prevent endless loops.
- repeatloopif -- decides whether to continue with a loop or to start over again from the top.
- stoploopif -- decides whether to continue with a loop or to exit the loop immediately.
- timelimit -- specifies the maximum time a procedure can continue to run after this statement.
- until -- is used at the end of a loop, and can control how many times the loop is executed.
- while -- is used at the end of a loop, and can control how many times the loop is executed.
|10.0||No Change||Carried over from Panorama 6.0.|