mercredi 23 août 2017

Simplifying if-else-if ladder such that the function calls are made only once

How would you simplify the following if-else-if ladder such that the function call is made only once?

if (Condition A){
    A();
}
else {
    if (Condition B) {
        A();
    }
} 

Aucun commentaire:

Enregistrer un commentaire