#ELSE

Top  Previous  Next

Action

Conditional compilation directive that tests for a NOT condition.

 

 

Syntax

#IF test

#ELSE

#ENDIF

 

 

Remarks

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. The code between #ELSE and #ENDIF will be compiled when the expression is not true.

 

 

See Also

#IF  , #ENDIF

 

Example

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

#IF Demo

 Print "Demo program"

#ELSE

 Print "Full version"

#ENDIF

 

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.