Ifelse()
IF() IFELSE()
FUNCTION: if(<expression>,<true string>,<false string>)
ifelse(<expression>,<true string>,<false string>)
This function returns <true string> if BOOLEAN <expression> is TRUE, <false string> otherwise. Much more efficient than an equivalent switch(). It can also return different messages based on whether <expression> is nothing or contains text. if() does the same thing, but the third, <false string> argument is optional.
Within <true string> and <false string>, the token #$ is replaced with the evaluated result of <expression>. This is useful when you want to test an expression and use its value without evaluating it twice.
Examples:
> think ifelse(v(test),Test exists!,Test doesn't exist.)
Test doesn't exist.
> think if(lattr(me/test*),Matched: #$,No match.)
Matched: test1 test2
Aliases: nonzero
Related Topics: BOOLEAN VALUES, switch().