If defined

Purpose: Conditional compilation.

 if-defined <symbol>
     <any code>
 end-defined

 if-not-defined <symbol>
     <any code>
 end-defined

if-defined will cause <any code> to be compiled if <symbol> is defined (see "--cflag" option in gg). If <symbol> is not defined, then <any code> is not compiled at all.

if-not-defined will cause <any code> to be compiled if <symbol> is not defined (see "--cflag" option in gg). If <symbol> is defined, then <any code> is compiled.
Examples
The following code will have a different output depending on how is application compiled:
 if-defined DEF1
     @Defined
 end-defined
 if-not-defined DEF1
     @Not defined
 end-defined

If compiled with:
gg -q

then the output is:
Not defined

If compiled with:
gg -q --cflag="-DDEF1"

then the output is:
Defined

See also
Program flow
break-loop  
code-blocks  
continue-loop  
do-once  
exit-handler  
if-defined  
if-true  
set-bool  
start-loop  
See all
documentation


Copyright (c) 2019-2024 Gliim LLC. All contents on this web site is "AS IS" without warranties or guarantees of any kind.