lundi 9 novembre 2015

Can I have a switch statement inside an If... else statement?

I am wondering if inside an if statement (especially in the else section) I can have a case switch.. something like this:

if (condition)
   statements
   else {
random number generator;
switch (selection) {
  case 1 :
    statements
  case 2 : statements
  }
}

Anyone can help? How can I accomplish something like that if this is not possible?

Aucun commentaire:

Enregistrer un commentaire