Why the output is 5 and not 7 | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
26th Jun 2019, 3:29 PM
Shaikh Mudasser Ali
Shaikh Mudasser Ali - avatar
3 Answers
+ 2
Because you printed num, not num + 2. By The way, you didn't use the break keyword, so that might mess it up
26th Jun 2019, 3:36 PM
Airree
Airree - avatar
+ 5
You didn't assign a new value to num. Try switch(num+=2)
26th Jun 2019, 3:49 PM
Anna
Anna - avatar
0
Airree if the tested numbers are 1,2, or 3, thats where having no break will mess it up 😀. That is, unless default is set before your cases
26th Jun 2019, 5:18 PM
Choe
Choe - avatar