Mastering switch

  • 16
  • Locked
Implement the switchTest method: 1. Don't use conditional operators. 2. Use 1 switch with 2 cases and 1 default. 3. Expected output: Output for E1.A: "it's E1.A", Output for E1.B: "it's E1.B", Output for E1.C: "it's E1.C", Output for E1.Y: "it's E1.Y", Output for E2.D: "it's E2.D".
You can't complete this task, because you're not signed in.
Comments (5)
  • Popular
  • New
  • Old
You must be signed in to leave a comment
Justin Smith
Level 38 , Greenfield, USA, United States
27 April 2022, 11:34
Failed the first time because I forgot the "it's" 🤣🤣🤣
Guadalupe Gagnon
Level 37 , Tampa, United States
9 May 2019, 15:28
*Warning* The expected output in the task conditions and the expected output noted in the starting code do not match. Use the example from the conditions to pass.
Roman
Level 41
10 May 2019, 06:40
In the comment you can see output for code above:
Solution.switchTest(E1.C);
Solution.switchTest(E3.D);
Solution.switchTest(E2.D);
In the task conditions you can see output for all cases:
Output for E1.A: "it's E1.A"
Output for E1.B: "it's E1.B"
Output for E1.C: "it's E1.C"
Output for E1.Y: "it's E1.Y"
Output for E2.D: "it's E2.D"
Output for E2.E: "it's E2.E"
Output for E2.F: "it's E2.F"
Output for all other values: "undefined".
all other values:
Output for E3.D: "undefined"
Output for E3.E: "undefined"
Output for E3.F: "undefined"
in the task we use:
Output for E1.C: "it's E1.C"
Output for E3.D: "undefined"
Output for E2.D: "it's E2.D"
Guadalupe Gagnon
Level 37 , Tampa, United States
10 May 2019, 13:09
The comment in the code is: It's E1.C < --- should be it's lowercase undefined It's E2.D <---- same
Roman
Level 41
13 May 2019, 06:10
Thanks, we'll fix it soon.