Quantcast
Channel: How can i use a switch case that has a case that does all the cases before - Stack Overflow
Browsing latest articles
Browse All 3 View Live

Answer by Gal Naor for How can i use a switch case that has a case that does...

I suggest defining a method (let's call it switchMethod) with the switch case - when all options are only 0 to 8.public void switchMethod(option) { switch (option) { case 1: do A; break; case 2: do B;...

View Article


Answer by michael for How can i use a switch case that has a case that does...

There are various ways to achieve what you need. I'll outline a few.Use methodsThis is simple, and somewhat clean and easy to maintain. All you need to do is wrap the code you would like to execute in...

View Article

How can i use a switch case that has a case that does all the cases before

So i am doing a simple menu in main class where it has 10 options from 0 to 9, i am using a switch case to get the option and then execute a certain code, and number 9 is to do all the options in the...

View Article
Browsing latest articles
Browse All 3 View Live