Copyright (C) 2000-2012 |
GNU Info (groff)if-elseif-else ------- `gtroff' has if-then-else constructs like other languages, although the formatting can be painful. - Request: .if expr anything Evaluate the expression EXPR, and executes ANYTHING (the remainder of the line) if EXPR evaluates to non-zero (true). ANYTHING is interpreted as though it was on a line by itself (except that leading spaces are swallowed). Note: Expressions, for more info. .nr xxx 1 .nr yyy 2 .if ((\n[xxx] == 1) & (\n[yyy] == 2)) true => true - Request: .ie expr anything - Request: .el anything Use the `ie' and `el' requests to write an if-then-else. The first request is the `if' part and the latter is the `else' part. .ie n .ls 2 \" double spacing in nroff .el .ls 1 \" single spacing in troff In many cases, an if (or if-else) construct needs to execute more than one request. This can be done using the `\{' and `\}' escapes. The following example shows the possible ways to use these escapes (note the position of the opening and closing braces). .ie t \{\ . ds lq `` . ds rq '' .\} .el \ .\{\ . ds lq " . ds rq "\} Note: Expressions. automatically generated by info2www version 1.2.2.9 |