Article View: comp.lang.modula2
Article #3950Re: Good Modula Style
From: Hal Chambers
Date: Tue, 17 Nov 1987 12:22
Date: Tue, 17 Nov 1987 12:22
29 lines
1611 bytes
1611 bytes
In article <INFO-M2%87111613494632@DB0TUI11> Info-Modula2 Distribution List <INFO-M2%UCF1VM.bitnet@jade.berkeley.edu> writes:
> IF TRUE THEN
> J := I + 1
> ELSIF NOT TRUE THEN
> J := I - 1;
.....
I would also recommend using semicolon as a statement terminator rather
than a separator. Modula-2 specifically allows the extra semicolon
so that this may be done.
IF TRUE THEN
J := I + 1;
ELSIF NOT TRUE THEN
J := I - 1;
.....
Although it isn't syntactically required, it results in a more uniform
appearance to the code. Also, if a substantial block of code follows
the IF and you latter add more statments to the block, it is easy to
miss the omitted semicolon when the J:=I+1 is no longer the last
statment of the block.
Admittedly this is a matter of style (read: personal preference) and
I do not claim that the form omitting the semicolon is in any sense
"ugly" or anything like that.
Hal Chambers
Technical Details
Message-ID:
<932@pur-phy>Path:
arc1-ca.pugleaf.net!utzoo!mnetor!uunet!husc6!rutgers!iuvax!pur-ee!pur-phy!halReferences:
<INFO-M2%87111613494632@DB0TUI11>Show Full Headers
Complete Article Headers
Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: arc1-ca.pugleaf.net!utzoo!mnetor!uunet!husc6!rutgers!iuvax!pur-ee!pur-phy!hal From: hal@pur-phy (Hal Chambers) Newsgroups: comp.lang.modula2 Subject: Re: Good Modula Style Message-ID: <932@pur-phy> Date: Tue, 17-Nov-87 07:22:14 EST Article-I.D.: pur-phy.932 Posted: Tue Nov 17 07:22:14 1987 Date-Received: Fri, 20-Nov-87 06:02:59 EST References: <INFO-M2%87111613494632@DB0TUI11> Reply-To: hal@newton.physics.purdue.edu.UUCP (Hal Chambers) Organization: Purdue Univ. Physics Dept., W. Lafayette, IN Lines: 29