manpagez: man pages & more
info groff
Home | html | info | man

File: groff.info,  Node: if-then,  Next: if-else,  Prev: Operators in Conditionals,  Up: Conditionals and Loops

5.23.2 if-then
--------------

 -- Request: .if cond-expr anything
     Evaluate the conditional expression COND-EXPR, and if it evaluates
     true (or to a positive value), interpret the remainder of the line
     ANYTHING as if it were an input line.  Recall from *note Invoking
     Requests:: that any quantity of spaces between arguments to
     requests serves only to separate them; leading spaces in ANYTHING
     are thus not seen.  ANYTHING effectively _cannot_ be omitted; if
     COND-EXPR is true and ANYTHING is empty, the newline at the end of
     the control line is interpreted 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

 -- Request: .nop anything
     Interpret ANYTHING as if it were an input line.  This is similar to
     '.if 1'.  'nop' is not really "no operation"; its argument _is_
     processed--unconditionally.  It can be used to cause text lines to
     share indentation with surrounding control lines.

          .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).

© manpagez.com 2000-2024
Individual documents may contain additional copyright information.