Flow control primitives

<if|condition|if-body>

<if|condition|if-body|else-body>
(conditional markup)

This primitive can be used to typeset if-body only if the condition is satisfied. If the optional else-body is specified, then it is typeset if and only if the condition fails.

Remark 1. It should be noticed that the use of conditional markup can be a bit tricky due to the fact that the accessability of arguments cannot necessarily be checked beforehand. For instance, in the macro definition

<macro|x|<if|<visibility-flag>|x>>

the macro argument x is accessible if and only if <visibility-flag> evaluates to true. This condition cannot necessarily be checked a priori. For certain editing operations, like searches or spell checking, the incorrect determination of the accessability may lead to the positioning of the cursor at unaccessible places, or to the ignorance of certain markup. In the future, we plan to improve this aspect of the editor, but it is better to avoid conditional markup whenever another solution can be found.

Remark 2. The conditional constructs are only fully implemented for inline markup. In the case when you need conditional markup for block structures you currently have to write macros for the if-case and the else-case and use the compound tag. For instance:

<assign|cold|<macro|x|<with|color|blue|x>>>

<assign|hot|<macro|x|<with|color|red|x>>>

<assign|adaptive|<macro|x|<compound|<if|<summer>|hot|cold>|x>>>

<case|cond-1|body-1||cond-n|body-n>

<case|cond-1|body-1||cond-n|body-n|else-body>
(case distinction)

These commands are respectively equivalent to

<if|cond-1|body-1|<if|cond-n|body-n>>

<if|cond-1|body-1|<if|cond-n|body-n|else-body>>

<while|condition|body>
(repeated evaluation)

This construct maybe used in order to repeatly execute a given body while a given condition is satisfied. For instance, when declaring

< assign | count | < macro | from | to | < with | i | from |

<\concat|

<while|<less|i|to>|i, <assign|i|<plus|i|1>>>

|

to

>

> > >

the code <count|1|50> produces

1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50

Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.1 or any later version published by the Free Software Foundation; with no Invariant Sections, with no Front-Cover Texts, and with no Back-Cover Texts. A copy of the license is included in the section entitled "GNU Free Documentation License".