Compiler directives: #if, #else, #endif

Syntax

#if constexpr
statements
[#else
statements]
[#endif]

 

Parameters

constexpr - constant integer expression.

statements - any statements.

 

Remarks

If value of constexpr is not 0, are compiled statements after #if and skipped statements after #else. Otherwise, are skipped statements after #if and compiled statements after #else.

 

Unlike if, compiler directives are evaluated only at compile time.

 

If #endif is omitted, are compiled (or skipped) all following statements until the end.

 

QM 2.4.1. #if/#ifdef/#ifndef can be nested in other #if/#ifdef/#ifndef or #else code block. Also now most directives can be tab-indented.

 

See also: #ifdef, #ret, predefined variables and constants, make exe.

 

Example

def TEST 5
#if !TEST
out "TEST is 0"
#else
rep 2
	#if TEST>=5
	out "TEST is >= 5"
	#else
	out "TEST is < 5"
	#endif
#endif