$iif

From Scriptwiki
Revision as of 02:57, 4 December 2005 by Doomie (talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

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.


See Also

To learn more about if-then-else, take a look at this article.