Liste des Groupes | Revenir à cl c |
David Brown wrote:You might also split up your functions differently, so that you can write :>the fact is it is somewhat hard to say which is more obvious to readers
It is best to write the code in the way that makes most sense - whatever
gives the best clarity and makes the programmer's intentions obvious to
readers, and with the least risk of errors.
if(key=='A') Something();
else if(key=='B') Something();
else if(key=='C') Something();
else if(key=='D') Something();
or
if(key=='A') Something();
if(key=='B') Something();
if(key=='C') Something();
if(key=='D') Something();
imo the second is more for human but logically its a bit diferent becouse else chain only goes forward on "false" and new statemant on both "true and false"
Les messages affichés proviennent d'usenet.