TUTOR (programming Language) - Unique Features - Control Structures

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 loop

Note 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:

    All industries are brought under the control of such people [film producers] by Capitalism. If the capitalists let themselves be seduced from their pursuit of profits to the enchantments of art, they would be bankrupt before they knew where they were. You cannot combine the pursuit of money with the pursuit of art.
    George Bernard Shaw (1856–1950)

    If there are people who feel that God wants them to change the structures of society, that is something between them and their God. We must serve him in whatever way we are called. I am called to help the individual; to love each poor person. Not to deal with institutions. I am in no position to judge.
    Mother Teresa (b. 1910)