Article View: net.lang.pascal
Article #18then else etc.
From: utzoodecvaxharponpoivhou5farielv...
Date: Sat, 19 Feb 1983 14:53
Date: Sat, 19 Feb 1983 14:53
30 lines
1449 bytes
1449 bytes
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
Technical Details
Message-ID:
<bnews.cornell.4012>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailShow Full Headers
Complete Article Headers
From: utzoo!decvax!harpo!npoiv!hou5f!ariel!vax135!cornell!hal Newsgroups: net.lang.pascal Title: then else etc. Article-I.D.: cornell.4012 Posted: Sat Feb 19 14:53:52 1983 Received: Sun Feb 20 06:32:25 1983 Subject: then else etc. Date: Sat, 19 Feb 1983 14:53:52 +0000 Message-ID: <bnews.cornell.4012>