mercredi 29 avril 2020

How to create a group of constants and check if a variable is or isn't included in that group?

I want to create an if code to check if variable x is a member of a defined group of constant named a, for example a = { 1 , 2 , 3 , 4 }, then use something like if (x != a).

I only know to use it like this if ( ( x != 1 ) || ( x != 2 ) || ( x != 3 ) || ( x != 4 ) )

Aucun commentaire:

Enregistrer un commentaire