I have inherited a large nested if else structure, I am trying to separate the leaves of the if else tree into separate if statements only e.g. :
if ( c1 )
{ dc1 }
else if ( c2 )
{ dc2 }
else {dc3}
should become something like :
if (c1) {dc1;}
if ((!c1) & (c2)) {dc2;}
if ((!c1) & (!c2)) {dc3;}
This is much simpler than the unholy structure I am trying to untangle.
Side question : it easy to see that there is no condition that takes into account the case
if ((c1) & (c2))
is there a tool or simpler way of linearising the if else structures and seeing all the conditions that have not been included.
I hope my example is correct.
Aucun commentaire:
Enregistrer un commentaire