# cs.utexas/EWD316  A Short Introduction to the Art of Programming

by  prof.dr. Edsger W.Dijkstra (1930–2002),  August 1971

cs.utexas/EWD E. W. Dijkstra Archive, the manuscripts.

0. Contents

1. Preface

2. Some Fundamental Notions

3. Programming Languages and their Implementation

4. Variables and relations between their values

5. Programs corresponding to recurrence relations

6. A first example of step-wise program composition

7. The shortest spanning subtree of a graph

8. The towers of Hanoi

9. The problem of eight queens

10. A rearranging routine

# 2. Some Fundamental Notions

rob: Ci tiene a sottolineare la differenza tra

• programma
• possibile esecuzione

The conditional connective connects two actions, the first of which must be a so-called "inspection". This inspection describes a state of affairs, which may be true or false ("false" is the technical term for "not true"). The happening which is to take place corresponding to the conditional compound

"if inspection do action"

may take one of two mutually exclusive forms:

• either the inspection gives the result true and it is followed by the action,
• or the inspection delivers the result false and thereby the whole compound action has been completed.

The algorithm derives its superiority over the eye-witness account from the fact that it may contain connectives (such as the conditional connective) that imply a more elaborate sequencing control than the semicolon.

Note. In the above

I have approached the idea of an algorithm starting my considerations

• from the class of happenings in which we wanted to discern the same pattern of behavior.

In addition to the semicolon as connective in the text of the algorithm this led to other connectives such as the conditional connective "if...do" and the repetitive connective "while...do".

It is not unusual to approach the relation between algorithm and computations

• from the side of the algorithm;

such an approach leads in a very early stage to syntactical considerations, as a result of which the connectives are introduced in a somewhat different terminology.

"if inspection do action"

people write

"if condition do statement" .

The part of the text denoted by "if condition do" is then described as "conditional clause" which is regarded as a prefix attached to the "statement", the whole construction comprising clause and statement together is then called "a conditional statement". Similarly, in

"while condition do statement" ,

"while condition do" is called "a repetitive clause" and the statement is called "the repeatable statement". This terminology is so widely used that —in spite of its syntactical origin— I shall not refrain from using it whenever I see fit to do so.

We call an algorithm intended to control the behaviour of a machine, a program.