Raised This Month: $ Target: $400
 0% 

Constant in if statements?


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 08-04-2011 , 15:04   Re: Constant in if statements?
Reply With Quote #7

Then use a loop checking each value of the array.

PHP Code:
stock bool:num_is_in_array(iNum)
{
    for( new 
0sizeof(array); i++ )
    {
        if( 
iNum == array[i] )
        {
            return 
true
        
}
    }
    return 
false

__________________

Last edited by fysiks; 08-04-2011 at 17:11. Reason: Added bool tag to function.
fysiks is offline
 



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 03:19.


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