1.22. 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 C++ section to tut/examples/tut114.flx[1 /1 ]
     1: include "std";
     2: var x = 1;
     3: val p1 = { print x; };
     4: proc p2() { print x; }; // equivalent to p1 (almost)
     5: 
     6: // all these calls have the same behaviour
     7: p1();
     8: p1;
     9: p2();
    10: p2;
    11: { print x; }();
    12: { print x; };
    13: print x; endl;
    14: 
End C++ section to tut/examples/tut114.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.