ifelse()
btmux-0.6-rc4/game/text/help/cat_mux/cat_functions/ifelse() · 667 B
From the archive btonline-btechmux-0.6-rc4.tbz2
Download the archive « Back to the archive contents
& ifelse() Syntax: ifelse(<expression>,<true string>,<false string>) This function returns <true string> if <expression> is true (greater than 0), <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. Example: > &TEST me=1 >&TEST.F me=ifelse(hasattr(me,TEST),Test exists!,Test doesn't exist.) > say [u(TEST.F)] You say "Test exists!" > &TEST me=Someval > say [u(TEST.F)] You say "Test exists!" > @wipe me/TEST > say [u(TEST.F)] You say "Test doesn't exist!" See Also: switch()