Next: if-else, Previous: Operators in Conditionals, Up: Conditionals and Loops [Contents][Index]
Evaluate the conditional expression cond-expr, and if it evaluates true (or to a positive value), interpret the remainder of the line input as if it were an input line. Recall from Invoking Requests that any quantity of spaces between arguments to requests serves only to separate them; leading spaces in input are thus not seen. input effectively cannot be omitted; if cond-expr is true and input is empty, the formatter interprets the newline at the end of the control line as a blank input line (and therefore a blank text line).
super\c
tanker
.nr force-word-break 1
super\c
.if ((\n[force-word-break] = 1) & \n[.int])
tanker
⇒ supertanker super tanker
Interpret
input
as if it were an input line.
nop
resembles
‘.if 1’;
it puts a break on the output if
input
is empty.
Unlike
if,
it cannot govern conditional blocks.
Its application is to maintain consistent indentation
within macro definitions even when formatting output.
.als real-MAC MAC .de wrapped-MAC . tm MAC: called with arguments \\$@ . nop \\*[real-MAC]\\ .. .als MAC wrapped-MAC \# Later... .als MAC real-MAC
In the above,
we’ve used aliasing,
nop,
and the interpolation of a macro as a string
to interpose a wrapper around the macro
‘MAC’
(perhaps to debug it).