Hairy Pixels via fpc-pascal said on Sun, 18 Jun 2023 08:04:23 +0700

>> On Jun 18, 2023, at 1:07 AM, tsie...@softcon.com wrote:
>> 
>> This is interesting, because it's the first time I've ever seen
>> "break" as a valid command in pascal, and I've been using pascal
>> since the mid/late 80s.  All kinds of dialects too, and I've never
>> seen break as a keyword.  C, Python, Perl, sure, even shell scripts,
>> but pascal? Never seen it used before.  Is this a relatively new
>> addition to fpc or something?  
>
>I don't remember break NOT being in Pascal. How did you exit a loop
>otherwise, goto? Break is common in basically all languages now. Can't
>think of a language I've used without it.

When I learned Pascal at Santa Monica Community College (SMC), the
professors repeatedly hammered home that a loop should have exactly one
entry point and one exit point. You don't exit until your test
condition goes false, and then you go down to the bottom of the loop
body and don't iterate further.. No matter how many levels of if
statements you had to use, you weren't supposed to use anything like
break, continue or exit in the loop. I don't remember whether those
keywords actually existed then.

I can still make a good argument for what my professors taught me, but
in the intervening years, I found break and especially continue
wonderful for increasing readability.


SteveT

Steve Litt 
Autumn 2022 featured book: Thriving in Tough Times
http://www.troubleshooters.com/bookstore/thrive.htm
_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Reply via email to