❔ switch
I looked at the microsoft docs and it shows a example of a switch statement, the thing is the example looks like something you could do just with a if statement, so what is the point of switch?
8 Replies
did you like how the if statement looks more than the switch statement
what?
look at the code. look at the switch statement, think about what it would look like if it was a series of if statements
which one would you like more
like, which one looks better to you
fair
switch doesnt have a bunch of brackets everywhere
or braces
that is the reason it exists. you are right that it does not do anything unique
wtv tf theyre called
Alright thank you
it has some nice syntax too
cases can "fall through", and you have full pattern matching available in the case
Was this issue resolved? If so, run
/close
- otherwise I will mark this as stale and this post will be archived until there is new activity.