(day_of_week) { case 1: case 2: case 3: case 4: case 5: document.write("Working Days"); ; case 6: | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

(day_of_week) { case 1: case 2: case 3: case 4: case 5: document.write("Working Days"); ; case 6:

(day_of_week) { case 1: case 2: case 3: case 4: case 5: document.write("Working Days"); ; case 6: document.write("Saturday"); ; default: document.write("Today is Sunday"); break; } Well done!

30th Nov 2021, 6:37 AM
ADITI NIGAM
ADITI NIGAM - avatar
4 Answers
+ 6
ADITI NIGAM Well that is one of the strangest codes I have seen. I am assuming it doesn't work, but I could be wrong. Could you specify which language you are using, and some details of what you are trying to achieve. IE: example input will produce example output
30th Nov 2021, 6:41 AM
Rik Wittkopp
Rik Wittkopp - avatar
+ 5
Hi Aditi Let me tell you that it is wrong You may write in this way switch (day_of_week) { case 1 : case 2 : case 3 : case 4 : case 5 : document.write("Working days"); break; case 6 : document.write("Saturday"); break; default : document.write("Today is Sunday"); }
30th Nov 2021, 8:15 AM
Ananya | Inactive |
Ananya | Inactive | - avatar
30th Nov 2021, 7:26 AM
Simon Sauter
Simon Sauter - avatar
- 1
document.write("saturday") ; break; is not correct also //console.log nice profile picture :)
24th Mar 2022, 12:44 PM
Ruby Sholeye
Ruby Sholeye - avatar