Go to the first, previous, next, last section, table of contents.


do

Control-struct: do{ ... loopFinish ... loopNext ... }
file: job.t
package: muf
status: alpha

Sometimes one wants the loop-termination test in the middle of the loop. do{ ... } constitutes an infinite loop.

The loopFinish operator is just like the C break operator: It terminates the loop tranferring control to the code following the loop.

The loopNext operator is just like the C continue operator: It transfers control to the top of the loop, beginning the next iteration: It is useful for quickly dismissing uninteresting cases in favor of proceeding immediately to the next iteration of the loop.

Stack:
0 10 for i do{ i 1 logand 1 = if [ "%d is odd\n" i | ]print , fi }
1 is odd
3 is odd
5 is odd
7 is odd
9 is odd
Stack:

Please note that MUF (following CommonLisp) does have functions named break and continue, but that they are very different from their C namesakes. See section break. See section continue.


Go to the first, previous, next, last section, table of contents.