The Conditional Iterative -do-
The conditional and iterative -do- can be combined so that, on each iteration, the conditional expression selects which unit to do this time:
For each value of i (from 1 to 12), the expression βN+3β is evaluated, which determines which subroutine will be done. For example, if βN +3β is 0, the above statement is equivalent to βdo ub,iβ1,12β. Usually a conditional iterative -do- is used in situations where the conditional expression (βN +3β ) is not changing, but doing one of the subroutines can change N so that a different subroutine is used on the next iteration. The following is an example of such manipulations:
In the first case, where i is equal to 1, the condition βi-2β is -1, so we do βuaβ. Then i is incremented to 2, and we do βubβ, etc. This is, therefore, equivalent to the sequence:
As usual, the specified units can involve the passing of arguments.
In a conditional non-iterative -do- the unit names βxβ and βqβ mean βdon't do anythingβ and βgoto qβ respectively. In a conditional iterative -do-, βxβ means βdon't do anything on this iteration,β and βqβ means βquit doing this statement and go on to the next statement.β In other words, βxβ means βfall through to the next iteration,β while βqβ means βfall through to the next TUTOR statement.β For example:
will display the number β3β. For i equal to 1 we do βuaβ; for i equal to 2 we do nothing; for i equal to 3 we quit and go on to the following -show- statement.