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:
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.