1.45. The while procedure

Here is the while procedure from the standard library, renamed While to avoid a clash:
Start C++ section to tut/examples/tut155.flx[1 /1 ]
     1: include "std";
     2: proc While (cond:unit->bool) (bdy:unit->void)
     3: {
     4:   repeat:>
     5:     if not (cond()) goto finished;
     6:     bdy();
     7:     goto repeat;
     8:   finished:>
     9: }
    10: 
    11: var x = 10;
    12: While {x>0} { print x; endl; x = x - 1; };
    13: 
End C++ section to tut/examples/tut155.flx[1]
Notice how simple and powerful the combination of the lazy expression syntax, block syntax, and currying are.

Felix actually only has a three procedural control structures: label/goto, procedure call/return, and raise/attempt/catch; and even the latter is only supported by the compiler for syntactic convenience.

The standard library defines several common procedural control structures.

Note that much of the rich control is obtained from the functional subsystem. For example the match expression is purely functional, it simply returns one of several expressions, but of course those expressions can be procedures which are subsequently called: here the default call syntax fools you into believing there is a match statement when actually there isn't.