AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   [ Solved ] #if , #elseif defined ... (https://forums.alliedmods.net/showthread.php?t=190037)

Aooka 07-14-2012 03:57

[ Solved ] #if , #elseif defined ...
 
Hello !

I've a question about it :
Code:
#if #elseif #else #endif
If they are more of these can you tell me.

So i don't understand and when can we do those check :
Code:
#if defined ??? && defined ??? public function(/*...*/) { /*...*/ } #endif

If you have some example... :)
Thanks :fox:

ConnorMcLeod 07-14-2012 05:42

Re: [ Request ] #if , #elseif defined ...
 
http://www.compuphase.com/pawn/Pawn_Language_Guide.pdf

Page 116

Code:

        #if  constant expression, #elseif, #else, #endif

        Portions of  a  program may be  parsed or be  ignored depending  on
        certain conditions.  The  pawn parser (compiler or interpreter) gen-
        erates code only for those portions for which the condition is true.

        The  directive  #if must  be  followed  by  a  constant  expression.          To
        check  whether  a  variable  or  constant  is  defined,      use  the  defined
        operator.
        Zero or more #elseif directives may follow the initial #if directive.
        These  blocks  are  skipped  if  any  of  the  preceding  #if or  #elseif
        blocks were parsed (i.e.    not skipped).  As with the  #if directive, a
        constant expression must follow the #elseif expression.

        The #else causes the parser to skip all lines up to #endif if the pre-
        ceding #if or any of the preceding #elseif directives were “true”,
        and the parses these lines if all preceding blocks were skipped.  The
        #else directive  may  be  omitted;  if  present,  there  may  be  only  be
        one #else associated with each #if.

        The  #endif directive terminates  a  program  portion that  is  parsed
        conditionally.  Conditional  directives  can  be  nested  and  each  #if
        directive must be ended by an #endif directive.


Aooka 07-14-2012 05:47

Re: [ Request ] #if , #elseif defined ...
 
Thanks :)
Solved


All times are GMT -4. The time now is 15:23.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.