- 2

Can Anyone confirm the code I have written is completely correct?

https://code.sololearn.com/ch52BMWVX8Zr/?ref=app

8th Jun 2020, 6:44 PM
Atharva Shinde
5 Respuestas
+ 3
I think everything is fine, but I agree with @Lo Coding and I think that you should add the default option: switch (age) { case n: /* code*/ default: System.out.println("Out of range"); break; }
8th Jun 2020, 7:18 PM
Nika
Nika - avatar
+ 2
Looks fine. What do you think could go wrong with this code that you had to confirm that it is correct? Just curious. Probably you can add a default just in case the user enters a value not in range 1 to 7, something that would say 'Day limit exceeded'.
8th Jun 2020, 6:48 PM
Avinesh
Avinesh - avatar
+ 2
Atharva Shinde , in addition as a default case you can add a message like for example "Invalid input" if the user's choice is not in this range 🐱
8th Jun 2020, 6:50 PM
TheWh¡teCat 🇧🇬
TheWh¡teCat 🇧🇬 - avatar
+ 2
You must add the default option: switch (age) { case n: /* code*/ default: System.out.println("Out of range"); break; } Is called when the other cases are incorrect
8th Jun 2020, 6:53 PM
LoCoding
LoCoding - avatar
+ 1
Thank you Guys🔥
8th Jun 2020, 7:42 PM
Atharva Shinde