[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Groff] Combining logical operators and conditions
From: |
Ralph Graulich |
Subject: |
Re: [Groff] Combining logical operators and conditions |
Date: |
Sat, 29 Jan 2011 00:04:03 +0100 |
> This doesn't work. groff.info says about 'XXX'YYY' and other
> operators:
>
> Note that these operators can't be combined with other operators
> like `:' or `&'; only a leading `!' (without whitespace between the
> exclamation mark and the operator) can be used to negate the
> result.
Oh, well... I read that paragraph at the end of the operator's section, but I
failed to connect this information to the whole list of operators. Now that I
reread it, it's clear why it doesn't work the way I expected it to work.
[...]
>> That works as expected, but there has to be an obvious and easy
>> solution without the additional number register.
>
> Not that I'm aware of. Note, however, if you have a lot of such
> comparisons, you could do the following:
>
> .ds str1 bar
> .
> .nr nr1 5
> .ds str1-foo \"
> .ds str1-bar \"
> .ds str1-baz \"
> .
> .if d str1-\*[str1] \
> . if (\n[nr1] == 5 ) \
> . tm okay
Interesting solution, indeed! -
It didn't solve my problem though, because I just posted an oversimplified
version of it to explain the general problem I had - although with the help of
your solution I was able to finally solve my problem, too.
Thank you very much for your help!
A question regarding to coding style: Which is considered the "better" way to
compare numbers, using "=" or "=="?
Best regards
Ralph