__FB_IIF__

Intrinsic define (macro) performed by the compiler.

Syntax
   __FB_IIF__( compare-expr, true-expr, false-expr )

Parameters
   compare-expr
      The comparison expression to test.
      A non-zero value evaluates as true, while a value of zero evaluates 
      as false.
   true-expr
      Source code to return if compare-expr is true.
   false-expr
      Source code to return if compare-expr is false.

Description
   __FB_IIF__ returns source code text depending on the result of a 
   comparison expression evaluated at preprocessing-time.
   Its typical use is in the middle of an expression; it avoids splitting 
   it to put a conditional in the middle.

   This intrinsic define (macro) differs from the IIf conditional statement 
   in that __FB_IIF__ is evaluated at compile-time only and returns source 
   code text.  IIf is evaluated at compile-time only if the compare-expr is 
   a constant.  Otherwise IIf expressions are evaluated at run-time.

Example
   ' From the example of the '#ELSE' documentation page:
      '#DEFINE MODULE_VERSION 1
      'Dim a As String
      '#IF (MODULE_VERSION > 0)
      '    a = "Release"
      '#ELSE
      '    a = "Beta"
      '#ENDIF
      'Print "Program is "; a

   ' Simpler code using '__FB_IIF__':
      #define MODULE_VERSION 1
      Dim a As String
      a = __FB_IIF__( MODULE_VERSION > 0, "Release", "Beta" )
      Print "Program is "; a

Version
   * Since fbc 1.10.0

Differences from QB
   * New to FreeBASIC

See also
   * #if
   * #else
   * #endif

