question about the operator ==

Hi! I'm new here.

Is it possible to use the == operator like this:

1
2
3
4
if (var1 == var2 == var3)
{
  // code here
}


If not, then is there a simple alternative?
Thanks! :)
If you write like that it will check like this:
if ( (var1==var2)==var3 )
so this is true if var1==var2 and var3==1
If you want to check wether all variables have the same value, you should write like this:
if (var1 == var2 && var2 == var3)
That explained it very clearly. Thanks!
Topic archived. No new replies allowed.