There is no formal “if/else” construct. However, you can approximate it with the macro label feature. For example, let’s say you can present the user with four different menus depending on some state variable. You could implement this with a couple of macros and an integer variable, and the variable i0 would hold the state, 0-3.

Your code would set i0 to the desired value, then call macro select_menu. Macro select_menu turns i0 into a label with an ‘m’ pre-pended, which is used in the call to display_menu.

#define select_menu
m display_menu:m`i0`
#end

#define display_menu
:m0
// display items suitable for menu 0
t "Menu 0" 100 100
:m1
// display items suitable for menu 1
t "Menu 1" 100 100
:m2
// display items suitable for menu 2
t "Menu 2" 100 100
:m3
// display items suitable for menu 3
t "Menu 3" 100 100
:default
// display or report parameter error t "!! Invalid parameter !!" 100 100
#end

 

You could also set up select_menu to accept a parameter that is the desired menu, and it would look like the following (barely different than above). Note that `0` is used instead of `i0`.

#define select_menu2 
m display_menu:m`0`
 #end