2.1.1. Macro values

The macro val statement defines a LHS symbol as the expansion of the RHS. The same value can be defined any number of times, a redefinition hides the preceding defintion until the end of the scope.
Start felix section to tut/examples/mac122.flx[1 /1 ]
     1: #line 187 "./lpsrc/flx_tut_macro.pak"
     2: #import <flx.flxh>
     3: macro val mx1 = 1+y;
     4: macro val mx2 = 2+y;
     5: val y = 100;
     6: print mx1; endl; // 101
     7: print mx2; endl; // 102
     8: {
     9:   macro val mx1 = 3+y; // 103
    10:   print mx1; endl;
    11:   macro val mx2 = mx2 + 10; // 112
    12: };
    13: print mx1; endl; // 101
    14: print mx2; endl; // 102
    15: 
    16: // illustration of rescanning
    17: macro val r1 = y1;
    18: macro val r2 = y2;
    19: macro val y1 = print;
    20: macro val y2 = 1;
    21: 
    22: r1 r2; // print 1
    23: endl;
    24: 
End felix section to tut/examples/mac122.flx[1]