View Single Post
  #17  
Old 10-07-2010, 08:02 AM
Tigairius Tigairius is offline
The Cat
Tigairius's Avatar
Join Date: Jan 2007
Location: Missouri, USA
Posts: 4,240
Tigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant future
Quote:
Originally Posted by Cubical View Post
It was mainly just for my curiosity because I don't even have Graal installed right now. I was wondering for something along the lines of this.
PHP Code:
switch(cmd){
  case 
"command1":
    break;
  case 
"command2":
    break;
  case 
"help": default:  // if help or no params are given then continue
    
sendtorc("commandlist");
    break;

Best way is to do it like this, as suggested in original post:

PHP Code:
switch (cmd) {
  case 
"command1":
  case 
"command2":
    
dostuff;
  break;
  
  default:
    
domorestuff;

either command1 or command2 will activate "dostuff;" and doesn't really hurt readability.
__________________


“Shoot for the moon. Even if you miss, you'll land among the stars.”