This question already has an answer here:
How can I compare a variable to a list of values of the same type in an if statement and make it readable and clean?
For example, I have the following, but there are a lot of values, and I want to make it more readable.
if ((lst->type == 'p' || lst->type == 'x' || lst->type == 'X' ||
lst->type == 'o' || lst->type == 'O' || (lst->type == 'd' ||
lst->type == 'i' || lst->type == 'D'))
Aucun commentaire:
Enregistrer un commentaire