endloop

The endloop statement is used at the end of a loop.


Parameters

No parameters.


Description

The endloop statement is used at the end of a loop. A loop is a sequence of statements that are executed over and over again. The beginning of the loop is always an loop, loopwhile, for or looparray statement.

When the endloop statement is encountered, Panorama always jumps back to the start of the loop. Use the endloop statement when you have included some other means for stopping the loop. For example the body of the loop could contain a stoploopif or return statement, or you could start the loop with loopwhile, for or looparray.

Here is an example that uses stoploopif to stop the loop.

local n,word,wl
wl=0 word="" n=1
loop
    word=array(Notes,n," ")
    stoploopif  word=""
    n=n+1
    wl=wl+length(word)
endloop
message "Average word length is: "+wl/n

This example uses the looparray statement to perform the same calculation.

local wl
wl=0
looparray Notes," ",word,n
    wl=wl+length(word)
endloop
message "Average word length is: "+wl/n

Note: In previous versions of Panorama the endloop statement was implemented as while forever or while true(). These alternative loop endings will still work.


Error Messages

ENDLOOP without LOOP – Each ENDLOOP statement must be paired with a corresponding LOOP statement. If this error message appears, the necessary statement beginning the loop has not been included.


See Also


History

VersionStatusNotes
10.0NewNew in this version