| TIP: Click on subject to list as thread! | ANSI |
| echo: | |
|---|---|
| to: | |
| from: | |
| date: | |
| subject: | Merits |
Re: Merits
By: Sean Dennis to Bo Simonsen on Sat May 01 2004 11:33 pm
> Or a poor Pascal programmer.
>
> Using a Repeat/Until loop, you can cause a loop to stop immediately.
>
> Also, I don't know what school you went to, but over here, in college, they
> teach C++, not Pascal. My last class in Pascal was in 1988, when I was in h
> school.
Agreed. I've been into discussions on this several times, and stand firm on
the principle I've gotten into many debates on before. Fact remains, if you
know what your doing, you can code *ANYTHING* without having to "break" out
of a loop, or "GOTO" a label, etc. The school I attended taught
"Logic" in a
class before teaching any programming language. Flowcharting was learned,
and you was to write all your programs on a flow chart first. This helped
you create programs that had 1 starting point and 1 ending point with no
nasty goto's, break's etc... Granted, its something you can't exactly do
with Windows and all those **** call-backs, events, handlers, etc. But...
Any pascal for loop can be re-done as a repeat/until, and while others may
not see the simplicity, it shows exactly what the compiler is generating....
Eg.
FOR Dummy := 1 TO 5 DO BEGIN
If You = 3 Then Dummy := 4;
IF Me = 2 Then Dummy := 5;
IF Me = You Then Dummy := 1;
IF Me > You Then Inc(Dummy);
END;
As
Dummy := 1;
REPEAT
IF (You = 3) Then Dummy := 4;
IF (Me = 2) Then Dummy := 5;
IF (Me = You) Then Dummy := 1;
IF (Me > You) Then Inc(Dummy);
Inc(Dummy)
UNTIL (Dummy > 5);
On the 2nd, to me its clearer when Dummy gets initialized, when Dummy is incre
mented, and When /how the loop repeats its self....
--- SBBSecho 2.00-Win32
* Origin: MLC-Group BBS -- mlc-group.dyndns.org (1:396/60)SEEN-BY: 633/267 270 @PATH: 396/60 45 106/2000 633/267 |
|
| SOURCE: echomail via fidonet.ozzmosis.com | |
Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.