mardi 30 juin 2015

Logical "or" (||) operator in an "if" statement

I have the following logic

if(a || b)
{
  if(a)
  // Do something if a is true
  else
  // Do something if b is true
}

is there any way to determine wether a was true in this if(a||b) condition or b was true in thr if(a||b) condition rather than agian checking in the if block which was true.

Note: I have put both a and b in the same if condition because of some same logic.

Aucun commentaire:

Enregistrer un commentaire