Modes of multiples start with brackets ([]
). A
multiple of characters has a special denotation. All multiples can be
constructed using a row-display. Rows have bounds and dimensions. Rows
can be sliced and trimmed, and their bounds can be changed using the
@
construct.
The FOR
loop has the form
FOR id FROM a BY b TO c DO ... OD
where the default values of a
, b
and
c
are 1
, 1
and ∞
respectively, but may take any value of mode INT
in a
meek context. If c
is greater than or equal to
a
and b
is negative, the loop will not be
executed. If b
is zero, the loop will be executed
indefinitely. The range of id
excludes the units
a
, b
and c
. The
FORALL
loop has the form
FORALL id1 IN row1 DO ... OD
We have covered a good deal of ground in this chapter, so here are some more exercises revising what you have learnt. It is most instructive to verify your answers by writing appropriate Algol 68 programs.
[]REAL r1 = [2.5,-2.5,3.5]
[,]INT i1 = ((1,2,3),(4,5,6,7))
[]CHAR s1 = "abcde'fg"
((10,20,30),(-10,-20,-30))
("a","b","c")
"abcdef"[3:4]
a
is declared as
[,]INT a = ((9,8,7), (6,5,4), (3,2,1))what is the value and mode of Ans
a[2,]
a[,2]
a[:2,3]
a[2:,:2]
"abc"*3+"defg"
yield?
Ans