0
Does the statement contained in a case statement be executed if the case doesn't match?
I think this is supposed to be a stupid question. But while playing with the code, i made something that seemed to me somewhat weird. You can check this code: https://code.sololearn.com/cU6LHwS56vH1/?ref=app Thanks in advance!
3 odpowiedzi
+ 1
Yes in this case the default case is operated
0
Lexfuturorum So you mean it will execute every thing until it sees a break statement, so i have to put my "cases" in a specific order to get the result i want?
0
No they don't have to be in a specific order the switch statement is kind of an else if statement the default case is the else at the end.