-
Notifications
You must be signed in to change notification settings - Fork 695
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
switch case logic #8
Comments
Hi, @uxrkhan Switch cases i.e. (X1 and X2) mentioned above have break statements. But the fact is default case should also include a break statement. @mortennobel thanks for creating this cheat sheet. You can insert a break for default case and close this issue. |
The switch case also support char type , not only int type, though char is a kind of int. switch (x) { // x must be int and char |
The switch case explanation is a bit misleading . There should be a break statement after every case for it to function as an if-else statement, otherwise it will evaluate all the cases.
The text was updated successfully, but these errors were encountered: