Top  Previous  Next


Conditional compilation directive that ends a test.




#IF test







An expression to test for. The expression may contain defined constants.


Conditional compilation is used to include parts of your program. This is a convenient way to build different files depending on some constant values.

Note that unlike the IF statement, the #IF directive does not expect a THEN.

You may nest conditions to 25 levels.

The use of #ELSE is optional.

Note that #ENDIF must be written as #ENDIF, not as #END IF



See Also





CONST DEMO = 1  ' 0 = normal , 1= demo

#IF Demo

 Print "Demo program"


 Print "Full version"


Since the constant DEMO is assigned with the value 1, the compiler will compile only the line : Print "Demo program" . Code between #else and #endif is not compiled!


When you change the constant DEMO to 0, the other line will be compiled.