+ 1

How to use a switch statement to output values of multiple variables?

The code is supposed to output according to the user defined values of multiple variables using a single switch statement. I'm a beginner btw.

17th Apr 2017, 4:07 PM
EXHALER Wolf
EXHALER Wolf - avatar
2 Answers
0
use switch(value){ case match1: //do something break; case match2: //do something else break; ....... default: //do final if none of the above matched //break optional only here but compulsion after each case }
17th Apr 2017, 4:29 PM
Chakri Monarch
Chakri Monarch - avatar
0
switch (choice) { case 1: { // All the executive code you want to perform break; } case 2: {//your codes break; } default : { your code for default statement break; } }
17th Apr 2017, 5:38 PM
Siddharth Upadhyay
Siddharth Upadhyay - avatar