Please i need an answer to this worry, base on the switch statement if i input a value that is not in any case nothing wil print | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Please i need an answer to this worry, base on the switch statement if i input a value that is not in any case nothing wil print

That is if i declared a variable a, assign it to 30, and switch a. Case 3 enfant ,case 18 beginning of maturity and case 25 mature, the out put will be blank?

8th Mar 2019, 10:50 AM
Agofack
Agofack - avatar
1 Answer
+ 5
Yes.. because after switch a variable.. it search for case 30.. and in your cases are 3,18,25...so result will be blank if you don't put a default statement... Learn from here https://www.sololearn.com/learn/CPlusPlus/1618/
8th Mar 2019, 10:59 AM
Scooby
Scooby - avatar