External values

Values denoted or manipulated by a program are called internal values. Values which exist outside a program and which are data used by a program or data produced by a program (or both) are known as external values.

In the previous sections we have been learning how plain values are denoted in Algol 68 programs. This internal display of values is not necessarily the same as that used for external values. If you copy the following program into a file and compile and run it you will get

 +10A +.15000000000000000e+1

output on your screen.

   PROGRAM test CONTEXT VOID
   USE standard
   BEGIN
      print(10);  print("A");  print(1.5)
   END
   FINISH

Notice that although the denotation for the first letter of the alphabet is surrounded by quote characters, when it is displayed on your screen, the quote characters are omitted. The rules for numbers are as follows: if a number is not the first value in the line it is preceded by a space. Integers are always printed in the space required by max int plus one position for the sign. Both positive and negative integers have a sign. A real number is always printed using the print positions required by max real, plus a sign for the number. The exponent is also preceded by a sign. If you want extra spaces, you have to insert them.

Try the following program:

   PROGRAM print2 CONTEXT VOID
   USE standard
   BEGIN
      print(10); print(blank); print("A");
      print(0.015); print(0.15); print(1.5);
      print(15.0); print(150.0); print(1500.0);
      print(15e15)
   END
   FINISH
Sian Mountbatten 2012-01-19