mardi 29 novembre 2016

Refactor a multi-layered if-then

Looking for someone to proofread my logic. I inherited a method that contains this:

If (a || b)
{
   doTaskOne();
}
else
{
    if (c)
    {
        doTaskOne()
    }
    doTaskTwo()
}

Could this be simplified like this?

If ((a || b) || c))
{
   doTaskOne();
}
else
{
    doTaskTwo()
}

Aucun commentaire:

Enregistrer un commentaire