Multiple statement is passed in IF condition using OR, how to find which statement is true?

You have to store the result of the conditions and then check it inside.

boolean atrue = a == 0;
boolean btrue = b == 0;
boolean ctrue = c == 0;
if(atrue || btrue || ctrue)
{
   if (atrue) {
     ..
   }
   if (btrue) {
     ..
   }
}

Leave a Comment