|| (OR) Substitution?

Hi guys. First post. I'm trying to create a loop where the condition could be one of a number of different values. I have already found out that the operator || can only compare 2 values. Is there another operator which can run a loop when any of several conditions are met? Example below:

while(notecount == (1||3||5... etc.)

Thank you in advance.
You have to repeat the variable you are checking:
(notecount == 1 || notecount == 3 || notecount == 5)
However you can use some tricks to shorten things
eg: if that condition was to check whether notecount is an odd number, you can use this condition: notecount%2 as % returns the remainder of the division between notecount and 2.
Or you can use switches:
1
2
3
4
5
6
7
8
switch(notecount )
{
    case 1: case 3: case 5:
       //do something
       break;
    default:
        //do something else
}
But this way is not the best for a loop
Thanks very much guys :)
Topic archived. No new replies allowed.