WWW | Store | Account | Contact Us
SHAZAM Homepage

DO

The DO command provides DO-loop capabilities that are useful for repeated calculations. The format of the command is: DO dovar = start, stop, inc The dovar is incremented by the value of inc. If inc is not specified then an increment of one is set. The DO-loop facility provides a numeric character substitution for the dovar variable which greatly aids in referencing named variables where the name contains a numeric increment e.g. VAR<dovar>, VAR<dovar+inc>,.. . DO-loops may also be nested. For instructions on the use of DO-loops see the chapter PROGRAMMING IN SHAZAM in the SHAZAM Reference Manual.

For example:

DO #=1,20,2
  GENR LX#=LOG(X#)
ENDO

The value of the DO character is substituted in all statements in the loop. Any special character (eg. #, ?, %, $, !) other than letters or numbers may be used for the DO character. Be sure to end the DO loop with the ENDO statement. DO-loops can be nested up to 18 levels.

Values are available in the temporary variables $DO, $DO2 - $DO18.

Type HELP ENDO and HELP ENDIF for more information.