A name is a value whose mode always begins with the mode
constructor REF
. A name can refer to a value whose mode
starts with one less REF
than the mode of the name. An
assignment causes a name to refer to a value. The value to which a
name refers can be superseded using a further assignment. An
assignment is a kind of unit and can appear in a formula if it is
enclosed by parentheses (or BEGIN
and END
).
Multiple assignments can be used to assign the same value to more than
one name.
A name can be generated using a local or global generator and can be made to refer to a value in the same phrase in which it is declared.
Algol 68 provides flexible names as well as fixed names for
multiples. The mode indicant for FLEX[]CHAR
is defined in the
standard prelude as STRING
. Names for multiples can have
bounds determined at run-time.
read
will convert external character sequences into internal
values. Its parameters must be names or newline
or
newpage
.
Name declarations may be written as identity declarations or in an abbreviated form.
Before continuing with chapter 6, it would be wise to revise the material in the first five chapters since these comprise the basis of the language.
-1
is read. Display the average on the screen. AnsREF STRING
name, then remove
leading and trailing spaces and add a space to the end. Use a
boolean name called in word
and make it refer to FALSE
.
As you step along the line, make in word
refer to FALSE
if you read a space and TRUE
otherwise. Keep a track of the
length of the current word. Whenever the value in word
changes
from TRUE
to FALSE
, extract the word using an
appropriate trimmer and print it. Allow for there being more than one
space between words. Ignore the possibility of commas, brackets etc.
Ans