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


if

Control-struct: if ... else ... fi
file: job.t
package: muf
status: alpha

Muq MUF's if ... else ... fi construct follows the Forth tradition:

Stack:
1 2 = if "1st\n" , else "2nd\n" , fi
2nd
Stack:
2 2 = if "1st\n" , else "2nd\n" , fi
1st
Stack:
2 2 = if "only\n" , fi
only

The if operator pops one value off the stack; if it is non-nil, the first clause is evaluated, otherwise the second clause (if present) is evaluated.

(I find curly braces inesthetic in the muf if-then-else construct, and believe that using fi as a terminator is both prettier and less confusing to novices than the traditional use of else as the terminator.)


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