The stoploopif statement decides whether to continue with a loop or to exit the loop immediately.
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 variable Last contains the value Smith and nothing else, and false otherwise.
Description
This statement decides whether to continue with a loop or to exit the loop immediately. If the test is true, the loop will exit and the program will continue after the corresponding endloop, until or while statement. If the test is false, the loop will continue normally.
Here is an example that uses stoploopif to stop the loop when there are no more words to process.
local n,word,wl
wl=0
loop
word=array(Notes,n," ")
stoploopif word=""
n=n+1
wl=wl+length(word)
endloop
message "Average word length is: "+wl/n
Error Messages
STOPLOOPIF must be used between LOOP and ENDLOOP statements – The stoploopif statement cannot be used outside of a loop.
See Also
History
Version | Status | Notes |
10.0 | No Change | Carried over from Panorama 6.0. |