Subsections

- Exercises

# Summary

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.

## Exercises

3.15
  What is wrong with the following identity declarations? Ans
  (a)
    `[]REAL r1 = [2.5,-2.5,3.5]`

  (b)
    `[,]INT i1 = ((1,2,3),(4,5,6,7))`

  (c)
    `[]CHAR s1 = "abcde'fg"`

3.16
  What are the upper and lower bounds of the following? Ans
  (a)
    `((10,20,30),(-10,-20,-30))`

  (b)
    `("a","b","c")`

  (c)
    `"abcdef"[3:4]`

3.17
  If `a` is declared as

         [,]INT a = ((9,8,7),
                     (6,5,4),
                     (3,2,1))

  what is the value and mode of Ans
  (a)
    `a[2,]`

  (b)
    `a[,2]`

  (c)
    `a[:2,3]`

  (d)
    `a[2:,:2]`

3.18
  What value does `"abc"*3+"defg"` yield? Ans
3.19
  Write a program to display every fifth letter of the alphabet all on one line. Ans