|
#IFNDEF | |||
Parameters: NONE | |||
Returns: NONE | |||
#IFDEF and #IFNDEF are similar to the #IF directive. It is also used in conjunction with #ELSE and #ENDIF and evaluated during compile time. It allows you selectively define sections of code that should be compiled, or be ignored. The difference is that #IFDEF returns True if a specified variable was previously defined, and #IFNDEF returns True if a specified variable was not defined. Example
#IF/#ELSE/#ENDIF Previously with the #IF/#ENDIF we've only been able to selectively compile one section code when the #IF expression is TRUE. However some times you need to selectively choose between two sections of code to compile. With the #ELSE directive, we gain this control. Depending upon the #IF expression is TRUE OR FALSE, will determine which section of code is compiled. So logically, when the #IF condition is TRUE, the code between the #IF and #ELSE directives is compiled. But when #If the condition is FALSE, the code after the #ELSE and between the #ELSE-#ENDIF is compiled. Example
This example would display (bellow), since the condition (Mode = 0) is True. Notice how the code between the #ELSE/#ENDIF is not compiled. So only the code between the #IF/#ELSE will exist in the compiled program.
|
Related Info: | #ENDIF | #IF : |
|
|||||||||||||||||||||||||||||||||||||||
(c) Copyright 2002 - 2024 - Kevin Picone - PlayBASIC.com |