groff
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Groff] condition: OR of two string comparisons


From: hohe72
Subject: [Groff] condition: OR of two string comparisons
Date: Thu, 6 Nov 2014 02:11:00 +0100

Hi, I wonder if this sample, that demonstrates OR of two string
comparisons, are an recommend way to code such conditions, avoiding an
extra macro or code doubling.

Regards Holger


.\" I found this for strings

.ds c "
.ds d "
.if '\*c'foo' .ds d "bar
.ie '\*d'bar' .tm *9: true
.el           .tm *9: false

.ds c "foo
.ds d "
.if '\*c'foo' .ds d "bar
.ie '\*d'bar' .tm *10: true
.el           .tm *10: false

.ds c "
.ds d "bar
.if '\*c'foo' .ds d "bar
.ie '\*d'bar' .tm *11: true
.el           .tm *11: false

.ds c "foo
.ds d "bar
.if '\*c'foo' .ds d "bar
.ie '\*d'bar' .tm *12: true
.el           .tm *12: false



.\" and was successful at numbers:

.nr a 0
.nr b 0
.ie ((\na=1) : (\nb=2)) .tm n1: true
.el                     .tm n1: false

.nr a 1
.nr b 0
.ie ((\na=1) : (\nb=2)) .tm n2: true
.el                     .tm n2: false

.nr a 0
.nr b 2
.ie ((\na=1) : (\nb=2)) .tm n3: true
.el                     .tm n3: false

.nr a 1
.nr b 2
.ie ((\na=1) : (\nb=2)) .tm n4: true
.el                     .tm n4: false



reply via email to

[Prev in Thread] Current Thread [Next in Thread]