Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Force 4.0 Reference - #else conditional compilation branching http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 #else               Conditional compilation branching
------------------------------------------------------------------------------
 Syntax
   #ifdef|#ifndef <macroname>
      <statements>
   #else
      <statements>
   #endif

 Arguments
   <statements> are source instructions for the compiler.

 Description
   The #else directive provides branching within conditional
   compilation blocks.

   When used with the #ifdef directive, the statements between #else and
   #endif will be compiled only if the identifer given as the argument
   of #ifdef was not defined.

   When used with the #ifndef directive, the statements between #else and
   #endif will be compiled only if the identifer given as the argument
   of #ifndef was defined.

 Example
   #define EXAMPLE_DIRECTIV
   #include example.hdr

   // this macro acts as a switch between two versions of the program
   #define VER_DEMO
   
   #define BANNER "Acme Proggie"
   
   #ifdef VER_DEMO
      #define BANNER BANNER + " Demo version"
   #else
      #define BANNER BANNER + " Registered"
   #endif
   
   proc Test_851
   ? BANNER
   #ifdef VER_DEMO
      ? "Program will stop running after a 10 minutes trial period"
   #else
      ? "Enter your key"
   #endif
   wait
   endproc

   proc main
   Test_851()
   endproc

See Also: #ifdef #ifndef

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson