[ << ] [ < ] [ Up ] [ > ] [ >> ]         [Top] [Contents] [Index] [ ? ]

12.16 IF

In its argumented form, allows the remainder of the line of code following IF to execute only if all tvexprs evaluate to true, provided the optional postcondition evaluates to true or is omitted.

Syntax

IF[:postcondition] tvexpr[,...tvexpr]

In its argumentless form, allows the remainder of the line of code following IF to execute only if $TEST evaluates to 1, provided the optional postcondition evaluates to true or is omitted.

Syntax

IF[:postcondition]  command...

Style Recommendation

In the interest of readability and maintainability, we recommend avoiding the argumentless form of IF in new code. It is an obsolete relic of an era when routine sizes were severely limited, and can be difficult to spot, as the use of whitespace (IF command) makes the intent of its use non-obvious at a glance. It is also far too easy to inadvertently delete the extra space, leading to program errors easily avoided otherwise.

We recommend explicitly checking the value of $TEST instead, as in IF $TEST command or command:$TEST ..., as this makes the intent immediately clear both to M newcomers and seasoned experts, and sacrifices nothing of value, even on the oldest computer systems where FreeM can be used today.


[ << ] [ < ] [ Up ] [ > ] [ >> ]         [Top] [Contents] [Index] [ ? ]

This document was generated on May 5, 2025 using texi2html 5.0.