We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
Hello: can I put on the case line more than one item to compare Like this
switch(aaa) { case: x or y or Z
}
I try with logical OR but doesnÂ't work.
Thanks and excuse me my english
Only constants allowed in case values - no expressions.
But you can write:
switch (aaa) { case x: case y: case z: do_something(); break; case w: do_something_else(); break; default: fallback_action(); }
This is plain, vanilla, standard 'C' - check your 'C' textbook.
Hint: What happens if you don't put a break at the end of a case clause...?