Next: , Previous: , Up: Built-in functions   [Contents][Index]


7.2.3.23 $IF: Two-way conditional

$IF is a primitive function (not a macro) that is the code-part version of ‘@#if’. The syntax is

$IF(expr, action-if-true, action-if-false)

The expr is an FWEB macro expression that must reduce to 0 (false) or 1 (true). First that argument is expanded. If it is true, action-if-true is expanded; otherwise action-if-false is expanded.

There may be peculiarities with this and the other built-in $IF function having to do with the order of expansion when the actions contain macros whose arguments themselves are macros. Therefore, do not use them unless absolutely necessary.

Do not redefine $IF or any other built-in conditionals, as they are used internally to FWEB.