0

Using two switch statements but getting only one output !! why?

2nd Jul 2018, 4:17 AM
Viren mahra
Viren mahra - avatar
4 ответов
+ 1
Could you provide the code so we can help you out?
2nd Jul 2018, 4:36 AM
Alexandru Turculet
Alexandru Turculet - avatar
0
May be because you haven't defined the default case in any or one of your switch statement. So only one switch statement have a case match, and second haven't. for maximum help , post your code snippet where you are having problem. (first upload it to the playground section, them share it's link here)
2nd Jul 2018, 5:02 AM
Nikhil Dhama
Nikhil Dhama - avatar
0
In some languages like C++ you also need a break; statement (or similar) in every case. Otherwise the next case will also be executed which might overwrite your result if this was not intended.
2nd Jul 2018, 5:56 AM
Matthias
Matthias - avatar
0
thanks guys my problem has been solved i was using break statement thats why i was getting only one output .
2nd Jul 2018, 11:33 AM
Viren mahra
Viren mahra - avatar