Quote:
Quote:
I probably wouldn't suggest coding this way:
While it propably won't do what SWITCH does in most languages (run a lot faster than a nested If-ElseIf-End If) it's a lot easier to read. Nice coding.


While in C (or other compiled language with switch), there are a couple advantages to using switch, it is not as likely possible to use a switch in mIRC and get those advantages since it is a scripting language. The only point of adding is would be "for looks".

BTW, I wouldn't say "runs a lot faster" above, I'd say it "run somewhat faster (only for compiled languages)". smile

You could also script this to some point... wink
Code:
alias switch { set %~SwitchEval $1 | return $null }
alias case { return $iif($1 == %~SwitchEval, $true, $false) }
alias case-switch-test {
  var %Test 1
  $switch(%Test) {
    if ($case(1)) { echo -s Testing 1 }
    if ($case(2)) { echo -s Testing 2 }
  }
}


NaquadaBomb
www.mirc-dll.com