mIRC Homepage
Posted By: Baeyens if elseif else statement - 02/01/21 09:06 PM
Hey mIRC team and Users,

is was wondering if anyone could help me and if the developers could check this out.
the if, elseif and else statement.
I've got some issues with it.
On the help page the first thing i read is
Quote

Basic format
if (v1 operator v2) { commands }
elseif (v1 operator v2) { commands }
else { commands }


So i tried
Quote

on *:TEXT:*:#: {
if ($1 === Yo){/msg $chan hi}
elseif ($1 === That){/msg $chan ok}
else {/msg $chan forget it}
}


But that failed.
While reading further and experimenting
i found the bottom partial script code to be working.
Can someone explain this to me, why this difference in statement?
Posted By: DooMaster Re: if elseif else statement - 03/01/21 12:36 PM
You need to add a space on
Code
){/msg $chan hi }


So use:

Code
) { /msg $chan hi }


Check and use the format as you see in the examples exactly, you can see more examples in the online wiki https://en.wikichip.org/wiki/mirc
Posted By: Wims Re: if elseif else statement - 03/01/21 01:03 PM
You need space around { and } (though } don't need a space on it's right if it terminates the line/file)
© mIRC Discussion Forums