McGettrick and formatting
chris hermansen
clhermansen@gmail.com
Sat Jan 17 04:16:43 GMT 2026
Hi everyone,
Spending a quiet Friday night with a copy of McGettrick on my desk and I
came across this, being an example of how one might keypunch a short Algol
68 program. He used quote stropping; I've "converted" it to UPPER
stropping for clarity:
BEGIN REAL R,CIRCUM,AREA;
READ(R);
CIRCUM := 2*PI*R; AREA := PI*R*R;
PRINT(("CIRCUMFERENCE AND AREA OF
A CIRCLE OF RADIUS", R, " ARE",
NEWLINE, CIRCUM," AND ",
AREA))
END
Just in case there is someone other than me using proportionally spaced
fonts (oh the shame of it all), READ..., CIRCUM := ..., and PRINT... are
left-aligned with the REAL to the right of BEGIN.
Similarly, A CIRCLE... is left-aligned with CIRCUMFERENCE (not the " but
the C) as are NEWLINE and AREA.
Note the lack of spaces after R, CIRCUM,
I thought this might be of interest. Had we not had the benefit of the
discussion about a style guide, I would have formatted this
BEGIN
REAL R, CIRCUM, AREA;
READ(R);
CIRCUM := 2*PI*R;
AREA := PI*R*R;
PRINT(("CIRCUMFERENCE AND AREA OF A CIRCLE OF RADIUS", R, " ARE",
NEWLINE,
CIRCUM, " AND ", AREA))
END
ie four spaces of indents for what's between BEGIN and END and eight spaces
of indents for the continuation of the PRINT call.
(NB not trying to get the discussion going further, just an observation).
--
Chris Hermansen · clhermansen "at" gmail "dot" com
C'est ma façon de parler.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://gcc.gnu.org/pipermail/algol68/attachments/20260116/7e4549ca/attachment-0001.htm>
More information about the Algol68
mailing list