lundi 29 juin 2020

Is there any possibility to simplify the nested condition into non nested in C#?

I have 3 conditions to check before returning true or false. Here is the table:

enter image description here

This can be achieved using below logic

if(!COND1 && !COND2)
{
    if(COND3)
    {
        return False
    }
    else
    {
        return True
    }
}
else
{
    return true
}

Can this be simplified without using nested if ?

Aucun commentaire:

Enregistrer un commentaire