2.1.2. Macro variables

The macro var 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.

Macro variables can be assigned a new value.

Start felix section to tut/macros/mac-2.01.02-0.flx[1 /1 ]
     1: #line 275 "./lpsrc/flx_tut_macro.pak"
     2: #import <flx.flxh>
     3: macro var mx1 = 1+y;
     4: val y = 100;
     5: print mx1; endl; // 101
     6: {
     7:   macro mx1 = 3+y; // 103 [assignment!]
     8:   print mx1; endl;
     9: };
    10: print mx1; endl; // 103 [uses assigned value]
End felix section to tut/macros/mac-2.01.02-0.flx[1]
Start data section to tut/macros/mac-2.01.02-0.expect[1 /1 ]
     1: 101
     2: 103
     3: 103
End data section to tut/macros/mac-2.01.02-0.expect[1]