Table Of Contents | Index |
By using #If, #Else, and #Endif, MarxMenu lets you control the code the compiler produces. Unlike If, Else, and Endif, these new commands are evaluated at compile time rather than run time. Thus, it allows you to produce smaller and faster runtime code.
Example:The #Define command supports referrences to environment variables. This allows you to control what is compiled based on the environment variables you have set. That way you can, for example, compile different code based on what fileserver you are on. This allows you to compile smaller and faster menus. Suppose you have an environment variable set for the file server name SERVER=BOSTON:
#Define A B
#If A #Define C #If B Writeln 1 #Else Writeln 2 #Endif #Else #If B Writeln 3 #Else Writeln 4 #Endif #Endif
#If C Writeln 'C' #Endif
Example:If the environment variable is set to a value that contains multiple words separated by spaces, then all the words will be defined.
#Define %Server% #If Boston ... #Endif
Example:
SET USERS=TOM DICK HARRY Your menu contains: #Define %Users% This causes TOM, DICK, and HARRY to be defined.
See Also: | #If |
---|
Category: | Conditional |
---|
Table Of Contents | Index |
|