if condition with && doesn't work

 

I have a problem with if condition and && operator.

This simple code alway give "true" as result, when must give "false". Any idea about the problem? I'm getting crazy....

Thanks in advace

   double a=3;
   double b=5;
   bool c=true;
   bool d=false;
   
   if ((a<b)&&(c=true)&&(d=true))
   {Alert("TRUE");}
   else
   {Alert("FALSE");}
   

 
CPR:

I have a problem with if condition and && operator.

This simple code alway give "true" as result, when must give "false". Any idea about the problem? I'm getting crazy....

Thanks in advace

You are using assignment instead of comparison operator for booleans

Change the code to this

   double a=3;
   double b=5;
   bool c=true;
   bool d=false;
   
   if ((a<b)&&(c==true)&&(d==true))
   {Alert("TRUE");}
   else
   {Alert("FALSE");}

and all will be OK

Reason: