jeudi 19 juillet 2018

C - Refactoring multiple OR in an if statement conditional

In an example like this, is there a nicer/better way to refactor all of the conditionals?

if (memberStatus == bronze || memberStatus == silver || memberStatus == gold) {
    return 1;
}
return 0;

Aucun commentaire:

Enregistrer un commentaire