$iif
Returns T or F depending on whether the evaluation of the Conditional C is true or false.
$iif(C,T,F)
Note that you can use more comparisons too (see example below). To get more information about this, take a look at If-then-else.
$iif() returns F if the conditional returns zero, $false, or $null, else T.
If you don't specify the F parameter, $iif returns a T value if the condition is true, and returns nothing if it's false.
Example
echo -a $iif($me == Dana, I am Dana, I am not Dana)
This would probably echo I am not Dana, as you don't have the nickname Dana.
echo -a $iif($ignore,Ignoring is turned on,Ignoring is turned off)
This would usually echo Ignoring is turned on, as it's turned on by default.
echo -a $iif($active == #help.script && Dana ison $active,Dana is there, Dana isn't there)
This would echo Dana is there if #help.script is your active window and Dana isin #help.script, else Dana isn't there.
on *:text:!test:*:{ msg $iif($chan,$chan,$nick) testing }
This event would trigger for channel and query text, and using $iif we can reply to $chan or $nick, depending on where it came from.
See Also
- If-then-else to learn more about if-statements.