Multiple variable input on a case statement #7610
Answered
by
FaustVX
RonLight
asked this question in
Language Ideas
-
What if the switch statement allowed multiple arguments? Let's say you have multiple variables and need to consider all permeations.
First example is the way I currently need to write it. (25 lines with lots of nesting)
A multi parameter format might look something like this: (15 lines and less nesting)
|
Beta Was this translation helpful? Give feedback.
Answered by
FaustVX
Oct 19, 2023
Replies: 1 comment 2 replies
-
This already works, just put parenthesis around the cese values switch (a, b)
{
case (0, 0):
State = "0,0";
break;
case (0, 1):
State = "0,1";
break;
case (1, 0):
State = "1,0";
break;
case (1, 1):
State = "1,1";
break;
} |
Beta Was this translation helpful? Give feedback.
2 replies
Answer selected by
RonLight
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This already works, just put parenthesis around the cese values
sharplab.io