Raised This Month: $ Target: $400
 0% 

Solved possibly unintended assignment


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 04-25-2022 , 18:55   Re: possibly unintended assignment
Reply With Quote #4

The if statement expects a conditional expression which generally is an expression to compare two or more values. A common conditional expression is to compare equality of two values using the "==" comparison symbol. So, when you try to assign a value to a variable instead of doing a typical conditional expression, it thinks that you might have mistakenly forgot to add the second equal sign.

So, to suppress the warning, you need to put your variable assignment in parentheses so that it tells the compiler that you are intentionally doing a variable assignment instead of having a typo in your conditional expression.

Example:
PHP Code:
static anim

if( (anim g_models[index][draw2]) )
{
    switch(
random_num(1DRAW2_CHANCE))
    {
        case 
DRAW2_CHANCEplay_anim(idanim)
        default: 
play_anim(id3)
    }

__________________

Last edited by fysiks; 04-25-2022 at 18:57.
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 21:22.


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