#ifnot

Syntax:

    #ifnot Condition
      ...
    [#else]
      ...
    #endif

Explanation:

The #ifnot directive is used to prevent a section of code from compiling unless Condition is false.

Condition has the same syntax as the condition in a normal GCBASIC If command. The only difference is that it uses constants instead of variables, and does not use "then".

Example:

    'This program will set the constant to true only if NOT a PIC family
    #chip 16F88, 8

    #ifnot ChipFamily = 14          ' <<< compiling the block only when the chip is NOT PIC family 14

      #define myConstant True

    #endif

Key line: #ifnot ChipFamily = 14 — ChipFamily = 14 identifies the mid-range PIC family the 16F88 belongs to, so on this chip the condition is true and the block is NOT compiled; myConstant would only be defined when compiling for a chip outside PIC family 14.

See Also:

  • #if — the positive-condition counterpart to this directive
  • #ifdef — testing whether a constant is defined, rather than its value