Shoutbox

Elseif? - Printable Version

-Shoutbox (https://shoutbox.menthix.net)
+-- Forum: MsgHelp Archive (/forumdisplay.php?fid=58)
+--- Forum: Messenger Plus! for Live Messenger (/forumdisplay.php?fid=4)
+---- Forum: Scripting (/forumdisplay.php?fid=39)
+----- Thread: Elseif? (/showthread.php?tid=74271)

Elseif? by Pizzaboy861 on 05-09-2007 at 04:48 PM

Hey I'm new to scripting with Messenger Plus! and was wondering if it had an elseif thingy. IE:

if(color == 'red')
    <do this>
elseif(color == 'blue')
   <do this>
elseif(color == 'green')
   <dothis>


does Messenger Plus! have anything like this?

Thanks!


RE: Elseif? by Felu on 05-09-2007 at 04:52 PM

use 'else if' MP!L scripting uses JScript syntax.


RE: Elseif? by Adeptus on 05-09-2007 at 06:37 PM

JScript (like most other languages borrowing from C) has the switch statement, which seems appropriate for what you want to do, especially if you are testing for more than three cases.  Documentation can be found here.


RE: Elseif? by Dennis Mike on 05-09-2007 at 09:30 PM

f(color == 'red'){
Debug.Trace("red")
}
elseif(color == 'blue')
{
Debug.Trace("blue")
}
elseif(color == 'green')
{
Debug.Trace("green")
}


RE: RE: Elseif? by deAd on 05-09-2007 at 10:12 PM

quote:
Originally posted by Dennis Mike
f(color == 'red'){
Debug.Trace("red")
}
elseif(color == 'blue')
{
Debug.Trace("blue")
}
elseif(color == 'green')
{
Debug.Trace("green")
}

that won't work... A switch statement would be good for this, but if you want to use an if statement it would be something like this (this is shortened):
code:
if(color == "red"){
// color is red
} else if(color == "blue"){
// color is blue
}