1.23. The block procedure

There is a procedure which is so useful, there is a special syntax for it, as described above in the section on lazy things: the block.
Start felix section to tut/examples/tut_beg114.flx[1 /1 ]
     1: #line 1131 "./lpsrc/flx_tutorial.pak"
     2: #import <flx.flxh>
     3: var x = 1;
     4: val p1 = { print x; };
     5: proc p2() { print x; }; // equivalent to p1 (almost)
     6: 
     7: // all these calls have the same behaviour
     8: p1();
     9: p1;
    10: p2();
    11: p2;
    12: { print x; }();
    13: { print x; };
    14: print x; endl;
    15: 
End felix section to tut/examples/tut_beg114.flx[1]
The block is a procedure taking a unit argument. So when you write one as a statement, it just gets called: note that unlike C, that thing in curley braces is an expression, and you must make a statement by adding a semi-colon, which has the effect of invoking it due to the short cut rule.