As an example, consider the following
expression:
$?x $?y both $| xonly $. $| $?y yonly $| none $. $.
This is just like the example in the previous section:
$?x text1 $| text2 $.
except that text1 and text2 are both conditionals:
text1 = $?y both $| xonly $.
text2 = $?y yonly $| none $.
The grouping when conditionals nest is from the outside in. In the following example,
parentheses have been inserted to show the groupings (they are not a part of
either expression):
($?x (text1) $| (text2) $. )
($?x ($?y both $| xonly $. ) $| ($?y yonly $| none $. ) $. )
Interpretation is from left to right. The logic of the second line is therefore this: if
both $x and $y have values, the result is both. If $x has a value but $y lacks one, the
result is xonly. If $x lacks a value but $y has one, the result is yonly. And if bothlack
values, the result is none.
The sendmail program does not enforce or check for balance in nested conditionals.
Each $? should have a corresponding $. to balance it. If they do not balance, sendmail
will not detect the problem. Instead, it might interpret the expression in a way
that you did not intend.
The depth to which conditionals can be nested is limited only by our ability to easily
comprehend the result. More than two deep is not recommended, and more than
three deep is vigorously discouraged.
21.
Pages:
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397