[net.lang.pascal] then else etc.

hal (02/19/83)

I've often suggested to students that they write if statements this way:

   if conditon then begin             if condition then begin
     statements              -or-       statements
   end else begin                     end
     statements
   end

This is a reasonable way to create a "bracketed" if statement, avoids
deep nesting caused by compound statements, and minimizes the number of
lines used on the terminal, which means you can see a useful amount of
code using a screen editor on a 24 line terminal.

Of course, this isn't the only possible way; if the statement is short,
there's no reason not to write

   if condition then statement;

But as a general approach, the bracketing scheme seems to work well.

Please, no religous debates about the ultimate indenting scheme for Pascal.
I don't want to start a long exchange of worthless notes of the flavor
"my indenting scheme is better than yours".  Of course, if you have some
useful, and hopefully novel, suggestions, feel free to post them.

Hal Perkins

uucp:    {decvax|vax135|...}!cornell!hal
arpa:    Hal@Cornell
bitnet:  Hal@crnlcs