can you use the comparison operators in a long chain in the same way as the assignment operator?, like so:
to mean 'if all 3 variables have the same value'.Code:if(varA == varB == varC) //do whatever
can you use the comparison operators in a long chain in the same way as the assignment operator?, like so:
to mean 'if all 3 variables have the same value'.Code:if(varA == varB == varC) //do whatever
>>to mean 'if all 3 variables have the same value'
No.
if (varA == varB && varB == varC)
When all else fails, read the instructions.
If you're posting code, use code tags: [code] /* insert code here */ [/code]
NO (Did you try it?)
But you and use AND & OR:
if((varA == varB) && (varB == varC)) // AND
if((varA == varB) || (varB == varC)) // OR
You CAN "chain" several ANDs or OR's together.
[EDIT]
Oops. Had a bitwise operators
Last edited by DougDbug; 03-24-2003 at 06:00 PM.
ok thanks