LOOP

Purpose : Performs a group of one or more high speed calculations as many times as required.

Format:
 LOOP  BEGIN  number
       statement
       statement
       . . . . .
       statement
  LOOP  END

Notes:  The  LOOP  statement allows the execution of  groups of  one or more mathematical statements  in a repetitive manner. The total number of groups to be executed is specified by  number  value.  number  may be a constant or a variable name. Only mathematical calculations   IF...ENDIF  statements and memory operations  are executed within a  LOOP .  After the last loop is executed program flow  is continued on the next script line after the appropriate  LOOP  END  statement.  LOOP  BEGIN...END  statements may be nested. Ensure that the proper combination of  LOOP   BEGIN...END statements exists. Failure to do so may produce unpredictable results.  Use the  LOOP BREAK  statement to break out one level of looping.

Examples:

# A Number to the nth power Solver
input number "  Enter a number: "
input power  " Enter the power: "
accum = 1

loop begin power
accum = accum * number
loop end

print number " to the power of " power " = " accum
pause
exit
 
 

See Also:  BREATHE   PROCESS     READ  WRITE