home | O'Reilly's CD bookshelfs | FreeBSD | Linux | Cisco | Cisco Exam

#  Chapter 12Nroff and Troff ## .if

```.if [
!
]```

condition
```
```

anything
```
```

If ``` condition ``` is true, do ``` anything ``` . The presence of an ! negates the condition. If ``` anything ``` runs over more than one line, it can be delimited by \{ and \} .

### Conditions

o

True if the page number is odd.

e

True if the page number is even.

n

True if the processor is nroff.

t

True if the processor is troff.

"``` str1 ``` "``` str2 ``` "

True if ``` str1 ``` is identical to ``` str2 ``` . Often used to test the value of arguments passed to a macro.

``` expr ```

True if the value of expression ``` expr ``` is greater than zero.

### Expressions

Expressions typically contain number register interpolations, and can use any of the following operators:

``` + -```

``` / *```

Multiplication, division.

``` %```

Modulo.

``` > <```

Greater than, less than.

``` >= <=```

Greater than or equal, less than or equal.

``` = ==```

Equal.

``` &```

Logical AND.

``` :```

Logical OR.

### Examples

```.if t .nr PD 0.5v  \" Set spacing between ms paragraphs
.if !"\\\$2"" \{\ \" If the arg 2 is non null, print arg 3 in bold
\fB\\\$2/\P\}``` 