> AN APOCRYPHL TALE
>
> I agree with Neven's style:
>
> > if something then begin
> > dostuff
> > end
> > else begin
> > dootherstuff
> > end;
When I first learned Pascal in school (during the Jurassic period)
we were encouraged to code if/then/else like this:
if something
then begin
dostuff
end
else begin
dootherstuff
end;
or of not blocked
if something
then dostuff
else dootherstuff;
this introduces a symmmetry between the "then" part and the "else"
part and lets you match them (the "then begin" and "else begin" will
match up at the same indentation level)
>
> This is a true story of a bug that was VERY expensive to repair, and had
the
> above style
> been used would never have occurred:
<snip ... >
it also has the advantage of causing a compiler error another
situation similar to the earlier example where the
"IF" line inadvertantly got deleted.
ComplexStatement1;
ComplexStatement2;
ComplexStatement3;
ComplexStatement4;
ComplexStatement5;
IF OnceInABlueMoon
THEN DoTheRareThing;
-ns
---------------------------------------------------------------------------
New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
Website: http://www.delphi.org.nz
To UnSub, send email to: [EMAIL PROTECTED]
with body of "unsubscribe delphi"
Web Archive at: http://www.mail-archive.com/delphi%40delphi.org.nz/