Article View: comp.lang.misc
Article #5427Re: Loops
From: john
Date: Mon, 04 Apr 1988 00:31
Date: Mon, 04 Apr 1988 00:31
32 lines
1386 bytes
1386 bytes
In article <AWJ9X4y00WAHE53kVi@andrew.cmu.edu>, jk3k+@andrew.cmu.edu (Joe Keane) writes:
> of flags. I want to call the style police when i see this (and don't even
> think about nested loops):
>
> done := false;
> while not done do begin
> do_some;
> if done_now then
> done := true
> else
> do_some_more;
> if done_already then
> done := true;
> { leaving out the else causes a mess }
> do_even_more
> end
Well it doesn't have to look that bad.
done := false;
while not done do begin
do_some;
done := done | done_now;
if not done then begin
do_some_more;
done := done | done_already;
end;
else do_even_more;
end;
I don't quite understand your { ... causes a mess} comment; I had to guess
- is do_even_more supposed to execute if done_already is false?
Technical Details
Message-ID:
<270@bby-bc.UUCP>Path:
arc1-ca.pugleaf.net!utzoo!mnetor!uunet!lll-winken!lll-tis!ames!pacbell!att-ih!alberta!ubc-cs!fornax!bby-bc!johnReferences:
<2827@enea.se> <1557@pasteur.Berkeley.Edu> <2773@mmintl.UUCP> <AWJ9X4y00WAHE53kVi@andrew.cmu.edu>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!mnetor!uunet!lll-winken!lll-tis!ames!pacbell!att-ih!alberta!ubc-cs!fornax!bby-bc!john From: john@bby-bc.UUCP (john) Newsgroups: comp.lang.misc Subject: Re: Loops Message-ID: <270@bby-bc.UUCP> Date: 4 Apr 88 00:31:13 GMT References: <2827@enea.se> <1557@pasteur.Berkeley.Edu> <2773@mmintl.UUCP> <AWJ9X4y00WAHE53kVi@andrew.cmu.edu> Organization: Burnaby, British Columbia, Canada Lines: 31 Summary: it doesn't have to be that bad