summaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
authorwl <wl>2010-07-28 16:53:33 +0000
committerwl <wl>2010-07-28 16:53:33 +0000
commit819deb8e912543224eb32c7545ba0d1ff047fd3d (patch)
tree8bb78ddd7db7e88607c8826d26fa4646669a776a /doc
parenteac6e14e1daa6732c58525896ee182be4387bb95 (diff)
downloadgroff-819deb8e912543224eb32c7545ba0d1ff047fd3d.tar.gz
* doc/groff.texinfo, man/groff.man: Document `!' operator better.
Diffstat (limited to 'doc')
-rw-r--r--doc/groff.texinfo26
1 files changed, 26 insertions, 0 deletions
diff --git a/doc/groff.texinfo b/doc/groff.texinfo
index acd86c4d..ae2ac6ea 100644
--- a/doc/groff.texinfo
+++ b/doc/groff.texinfo
@@ -5128,6 +5128,32 @@ requests).@footnote{Note that, for example, @samp{!(-1)} evaluates to
`true' because @code{gtroff} treats both negative numbers and zero as
`false'.} See below for the use of unary operators in motion requests.
+@cindex logical not, limitation in expression
+@cindex expression, limitation of logical not in
+The logical not operator,
+as described above,
+works only within @code{if} and @code{while} requests.
+Furthermore, it may appear
+only at the beginning of an expression,
+and negates the entire expression.
+Attempting to insert the @samp{!} operator
+within the expression results in a
+@samp{numeric expression expected} warning. This
+maintains bug-compatibility
+with old versions of @code{troff}.
+
+Example:
+
+@Example
+.nr X 1
+.nr Y 0
+.\" This does not work as expected
+.if (\n[X])&(!\n[Y]) .nop X only
+.
+.\" Use this construct instead
+.if (\n[X]=1)&(\n[Y]=0) .nop X only
+@endExample
+
@item
@cindex extremum operators (@code{>?}, @code{<?})
@cindex operators, extremum (@code{>?}, @code{<?})