Forum Discussion

VasanthVijay's avatar
VasanthVijay
Contributor
9 years ago

i create a condition like if(a != b || b != c )

a = 5

b= 5 

c = 5

at this conditon it goes to else part but it go inside of if condition

if(a!=b || b!= c)

{

     log.messave(a);

}

else

{  

    log.message(b);

}

2 Replies

  • Hi ,

    control should go to ELSE block. It cannot go to IF block. it evaluates to false || false which is false.

     

  • AlexKaras's avatar
    AlexKaras
    Champion Level 3

    Hi,

     

    As a side note: to avoid possible error with operation priorities and to make the code more evident, I used to explicitly include separate conditions into parenthesis. I.e. :

    if((a!=b) || (b!= c))

      ...