mIRC Home    About    Download    Register    News    Help

Print Thread
Page 2 of 2 1 2
Joined: Nov 2004
Posts: 822
J
Hoopy frood
Offline
Hoopy frood
J
Joined: Nov 2004
Posts: 822
He ment goto break.

G
Ghozer
Ghozer
G
Quote:
What are you talking about? There is no /break or /halt command in the code.


yeah, i was meaning the goto break, i was speaking literal re: yours and previous 'hack' versions and ways round it..

D
DaveC
DaveC
D
Better would be this

Code:
alias moo { 
  var %moo = $1
  var %in = $true | while (%in) { var %in = $false
    goto %moo {
      :cow 
      echo -a moo cow 
      break 
 
      :dog 
      echo -a moo dog 
      break
 
      :d&c
      echo -a moo duck
 
       :cat 
      echo -a moo cat 
      break
 
      :%moo 
      echo -a moo mouse 
      break
    }
  }
  echo -a code beyond the case
}


thats pretty read able as well, and we even get to use the real /BREAK command

[edit]
I just thought as well it leads to another interesting option, the ability to alter %moo and recall the case select if you so desired, by use of the /CONTINUE comand, forcing it to return to the top of the while loop.

Last edited by DaveC; 16/10/06 11:13 PM.
Joined: Apr 2004
Posts: 755
M
Hoopy frood
Offline
Hoopy frood
M
Joined: Apr 2004
Posts: 755
Hey cool nicely "abused" mate never thought of that before. Its still not indented correctly but still the half of something is better then a whole lot of nothing smile

if implemented i would also like to see the case statement using () as well as suppose to JS/PHP since we dont use quoted strings
Code:
switch (%var) { 
  case (dog) { 
    echo -a what you know! its a dog!
    break
  }
  default { 
    echo -a what you know! its not a dog :(
  }
}

Though default doesn't really need bracketing there :tongue:

Joined: Jan 2003
Posts: 2,125
Q
Hoopy frood
Offline
Hoopy frood
Q
Joined: Jan 2003
Posts: 2,125
It would be much more readable without the extra pair of braces and the additional indentation of the while block, but it's an interesting idea nonetheless.

Page 2 of 2 1 2

Link Copied to Clipboard