Help with recursive default switch statement please


#1

I wonder how to make a case in a Switch Statement function recursive.
Example:

var options = function(picks, one, two) {
switch(picks) {

 case 1:
     // do whatever
    break;
  case 2:
     // once again whatever
     break;
  default : 
     options(picks, one, two); // RERUN THE SWITCH HERE // 
  }
};

How do I make that happen?
Thanks in advance!

// Sorry for not indenting my code properly here, but every time I hit tab it just worked the way tab usually does in browsers, and jumped to another window.
I tried spaces but they are not visible.
At least not in the preview.


#2

For proper indention you
-1 select the code
-2 click on the </> button of your editor

For discussions / opinions
google search
javascript recursive switch site:stackoverflow.com
http://stackoverflow.com/questions/12142122/recursive-switch-statement


#3

Thank you very much!