If condition A is matched, condition B needs to be matched in order to do action C

Viewed 13745

My question is:

if (/* condition A */)
{
    if(/* condition B */)
      {
         /* do action C */
      }
    else
      /* ... */
}
else
{
   /* do action C */
}

Is it possible to just write the code of action C one time instead of twice?

How to simplify it?

12 Answers
Related