Syntax: .IF symbolic-constant
Discussion: The .IF statement is a compiler directive. As such, it causes an action to occur when the program is compiled, not when the program is executed. The .IF directive can appear anywhere in an Internet Basic source program. Within an Internet Basic source program, specific lines can be identified as conditional source segments. A conditional source segment begins with the .IF directive (or one of its alternatives) and ends with the .ENDIF directive, as follows:
.IF symbolic-constant ! (conditional source segment) ! .ENDIF
The Internet Basic compiler will compile the conditional source segment only if the symbolic constant has been SET to a non-zero value.
See Conditional Compilation.
Example: In the following example, the symbolic constant named ABC is set to a non-zero value. When the compiler reaches the .IF directive, it compiles the subsequent lines up through the .ENDIF directive. Note, however, that if ABC was either not defined (not SET) or contained a value of 0, the compiler would skip the conditional source segment.
SET ABC = 1 ! set the symbolic constant to a non-zero value ! .IF ABC ! beginning of conditional source segment ! Internet Basic code segment ! .ENDIF ! end of conditional source segment