Help me on the error in "if...condition"

 

Hello Friends

I am stuck with a following if condition!!!

if(!(cCPRM15.rangeR2_R1(CPRD01,j,k) || cCPRM15.rangeR1_Top(CPRD01,j,k)))    return(false);

I want to return(true), if either one condition is true, else return(false).

I have tried using && operator too, but it is always returning [false]

Please point out, where I am doing wrong.

Thanks and regards.

 
Anil Varma:
I want to return(true), if either one condition is true, else return(false).
return(cCPRM15.rangeR2_R1(CPRD01,j,k) || cCPRM15.rangeR1_Top(CPRD01,j,k));
 
Anil Varma:

Hello Friends

I am stuck with a following if condition!!!

I want to return(true), if either one condition is true, else return(false).

I have tried using && operator too, but it is always returning [false]

Please point out, where I am doing wrong.

Thanks and regards.

Do you mean XOR/exclusive OR?
 
Tobias Johannes Zimmer #:
Do you mean XOR/exclusive OR?

Requirement is as below ...

if one of the two conditions is true, --> return(true)

if both conditions not true --> return(false)

 
Anil Varma #:

Requirement is as below ...

if one of the two conditions is true, --> return(true)

if both conditions not true --> return(false)


if ( cCPRM15.rangeR2_R1(CPRD01,j,k) || cCPRM15.rangeR1_Top(CPRD01,j,k) )  
   {
      return(true);
   }
else 
   {
      if ( !cCPRM15.rangeR2_R1(CPRD01,j,k) && !cCPRM15.rangeR1_Top(CPRD01,j,k) )  
         {
            return(false);
         }
      return(true);   
   }   
      
Reason: