Control Structures
Aside from its unique answer judging mechanisms, TUTOR's original set of control structures was rather sparse. In the mid 1970's, this shortcoming was addressed by introducing if, endif blocks with optional elseif and else sections. The semantics of these control structures was routine, but the syntax was unique, with mandatory indentation presaging that of Python and a unique use of nonblank indent characters to distinguish indenting from continuation lines.
This is illustrated in the following example, from page S5 of the Summary of TUTOR Commands and System Variables (10th ed) by Elaine Avner, 1981:
if n8<4 . write first branch . calc n9⇐34 elseif n8=4 . write second branch . do someunit else . write default branch . if n8>6 . . write special branch . endif endif(The assignment arrow in the calc statement is not rendered correctly in some browsers. It appears similar to <= but as one character. It had a dedicated key on the PLATO IV keyboard.)
The same syntax was used for loop, endloop blocks with semantics comparable to while loops in conventional programming languages. This is illustrated in the following example, from page S6 of the Summary of TUTOR Commands and System Variables (10th ed) by Elaine Avner, 1981:
loop n8<10 . write within loop . sub1 n8 reloop n8≥5 . write still within loop . do someunit outloop n8<3 . write still within loop endloop write outside of loopNote that the reloop and outloop commands are somewhat analogous to the continue and break statements of languages based on C, except that they must sit at the indenting level of the loop they modify, and they have a condition tag that indicates when the indicated control transfer is to take place.
Read more about this topic: TUTOR (programming Language), Unique Features
Famous quotes containing the words control and/or structures:
“Not being able to control events, I control myself; and I adapt myself to them, if they do not adapt themselves to me.”
—Michel de Montaigne (15331592)
“It is clear that all verbal structures with meaning are verbal imitations of that elusive psychological and physiological process known as thought, a process stumbling through emotional entanglements, sudden irrational convictions, involuntary gleams of insight, rationalized prejudices, and blocks of panic and inertia, finally to reach a completely incommunicable intuition.”
—Northrop Frye (b. 1912)