Wrote section on Existential Conditionals.
1 parent fbccb88 commit 1d45a83b455b46cb48c2fd1227dbf63487bd6391
@tundra tundra authored on 16 Apr 2004
Showing 1 changed file
View
158
tconfpy.3
can understand the logical structure of the conditions. It's also a
good idea to put comments throughout such conditional blocks so it's
clear what is going on.
 
.SS Existential Conditionals
 
 
.SS Comparison Conditionals
.SS Existential Conditional Directives
 
There are three Existential Conditionals: \'.ifall\', \'.ifany\', and \'.ifnone\'.
Each has the same syntax:
 
.nf
ExistentialDirective [var] ...
included if True
 
.else # optional
include if False
.fi
.fi
 
In other words, existential conditionals require
.B one or more variable references.
In each case, the actual content of that variable is ignored. The test is merely
checking to see
.B if a variable by that name exists.
Nothing else may appear on an existential conditional line, except,
perhaps, a comment.
 
The three forms of existential conditional tests implement three different kinds of
logic:
 
.nf
.ifall [var1] [var2] ...
 
This is a logical "AND" operation. ALL of the variables, \'var1\', \'var2\' ...
must exist for this test to be True.
 
.ifany [var1] [var2] ...
 
This is a logical "OR" operation. It is True of ANY of the variables,
\'var1\', \'var2\' ... exist.
 
.ifall [var1] [var2] ...
 
This is a logical "NOR" operation. It is True only if NONE of the variables,
\'var1\', \'var2\' ... exist.
.fi
 
Here is an example:
 
.nf
F00 = 1
BAR = 2
z = 0
 
.ifall [FOO] [BAR]
x = 1
.endif
 
.ifany [FOO] [foo] [fOo]
y = 2
.endif
 
.ifnone [BAR] [bar] [Bar] [SOmething]
z=3
.endif
.fi
 
When \*(TC finishes processing this, x=1, y=2, and z=0.
 
You can also use references to environment variables in an existential
conditional test:
 
.nf
.ifany [$MYPROGOPTIONS]
options = [$MYPROGOPTIONS]
 
.else
options = -b20 -c23 -z -r
 
.endif
.fi
 
.SS Comparison Conditional Directives
 
.SS The \'.literal\. Directive