next up previous contents
Next: 2.8 echo Up: 2. General commands Previous: 2.6 continue

2.7 do

Loops can be programmed with the 'do' command. The command may take the following forms:

a)
do <variable> = <start>,<end> [,<increment>]
  <commands to be repeated>
enddo
 
b)
do while (<logical expression>)
  <commands to be repeated>
enddo
 
c)
do
  <commands to be repeated>
enddo until (<logical expression>)
Type a) loops may contain constants or arithmetic expressions for <start>, <end>, and <increment>. The internal type of the variables is real. The loop counter is evaluated from (<end> - <start>)/<increment> =1 . If this is negative, the loop is not executed at all.

Type b) loops are executed while <logical expression> is true. Thus, they may not be executed at all.

Type c) loops, however, are always executed once, and repeated until <logical expression> is true.

If an error occurres during execution of the loop, the loop is interrupted.


Thomas Proffen {Billinge}
1999-07-20