Futurebasic/Language/Reference/compile long if

= COMPILE LONG IF statement =

Statement
✔ Appearance ✔  Standard ✔  Console

Syntax
COMPILE LONG IF condition   [statementBlock1] [COMPILE XELSE   [statementBlock2]] COMPILE END IF

Description
You can use the  statement to conditionally include or exclude selected lines of code from the compiled version of your program. This is useful if you need to maintain two (or more) slightly different versions of your program;  allows you to maintain them both within the same source file.

If the condition following  is evaluated as "true" or non-zero, then the statements in   are included in the compilation and the statements (if any) in   are ignored by the compiler. If the condition is evaluated as "false" or zero, then the statements in  are ignored by the compiler, and the statements (if any) in   are included in the compilation.

must be in one of the following forms:

 A list of any of the above separated by " " or " ". You may also optionally surround any valid sub-condition with parentheses.



is a "static integer expression." A static integer expression is any valid expression which consists of only:

 integer literal constants;

previously-defined symbolic constant names;

operators (like +, -, *, /, &gt;, =);

parentheses



(In particular, it can't contain variables, nor function references.) If you use this form of, then the condition will be evaluated as "true" if the expression's value is nonzero.

stands for a symbolic constant name. is evaluated as "true" if the indicated constant was previously defined. is evaluated as "true" if the indicated constant was not previously defined.

The condition  is evaluated as "true" if debugging has been activated for the current section of code. The condition  is evaluated as "true" if debugging has not been activated for the current section of code. (See the  statement for more details.)

If you use the keyword  as the condition, it's evaluated as "true" if the current compilation is being compiled into Motorola 680x0 ("68k") machine code. If you use the keyword  as the condition, it's evaluated as "true" if the current compilation is being compiled into PowerPC machine code.

Example
Because  can cause lines (including non-executable lines) to be completely ignored by the compiler, you can use it to control such things as the declaration of variables, program labels, constants, and even entire functions. For example:

Note: blocks can be nested to a depth of 16 levels.