SAY [expression] |
The SAY instruction computes the value of its optional expression, and sends the result as a line to the default output stream. Often this will be the program's console. When the expression is absent, the empty string is written.
A simple example of the SAY instruction is:
say 2 + 2
shows: 4 |
An improved version of the above is:
say 'The result of 2 + 2 is:' 2 + 2
shows: The result of 2 + 2 is: 4 |
In the above example the caption and the computation result were concatenated with an intervening space.
Another example of the SAY instruction is:
magic1 = 'open'
magic2 = 'sesame' say magic1 magic2
shows: open sesame |
In the above example the two magic words were concatenated with an intervening space.
A more elaborate example of the SAY instruction is:
/* get year, month, and day of month */
parse value date( 'Standard' ) with yr 5 . say right( time( 'Civil' ), 8) center( date( 'Month' ), 38 ), || substr( yr, 3 )'.'right( date( 'Dayofyear' ), 3, '0' ) shows a line similar to the following: 2:38pm July 02.189 |
The above example used the PARSE instruction
and the following built-in functions;
  CENTER,
  DATE,
  TIME,
  RIGHT,
  SUBSTR
The expression includes a variety of string concatenation operations.
The SAY instruction is entirely equivalent to the following:
call lineout , expression |
See the LINEOUT built-in function's description for details.