#ENDIF

Top  Previous  Next

Action

Conditional compilation directive that ends a test.

 

 

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.

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

 

 

See Also

#IF , #ELSE

 

 

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.