Re: [fpc-pascal] Legitimate use of for and break

2023-07-01 Thread Hairy Pixels via fpc-pascal
> On Jul 2, 2023, at 3:25 AM, Steve Litt via fpc-pascal > wrote: > > I tend to put continue statements at or near the top of the block, to > summarily rule out some obvious irrelevant iterations without all sorts > of if/then/else nesting. As a practical matter it's more readable and > more

Re: [fpc-pascal] Legitimate use of for and break

2023-07-01 Thread Steve Litt via fpc-pascal
Santi via fpc-pascal said on Sat, 1 Jul 2023 10:22:48 +0200 >El 16/06/2023 a las 16:09, Mattias Gaertner via fpc-pascal escribió: >> On Fri, 16 Jun 2023 20:51:42 +0700 >> Hairy Pixels via fpc-pascal wrote: >> On Jun 16, 2023, at 6:23 PM, Thomas Kurz via fpc-pascal wrote: >> 20

Re: [fpc-pascal] Legitimate use of for and break

2023-07-01 Thread Santi via fpc-pascal
El 16/06/2023 a las 16:09, Mattias Gaertner via fpc-pascal escribió: On Fri, 16 Jun 2023 20:51:42 +0700 Hairy Pixels via fpc-pascal wrote: On Jun 16, 2023, at 6:23 PM, Thomas Kurz via fpc-pascal wrote: Whether it's elegant is a different question. In my opinion YES because it often gives

Re: [fpc-pascal] Legitimate use of for and break

2023-06-22 Thread wkitty42--- via fpc-pascal
On 6/21/23 10:54 AM, Steve Litt via fpc-pascal wrote: wkitty42--- via fpc-pascal said on Wed, 21 Jun 2023 08:07:59 -0400 On 6/20/23 10:54 PM, Steve Litt via fpc-pascal wrote: It was a long time ago, but if I remember correctly the Whitesmith Pascal and Turbo Pascal 2 and 3 had either break or

Re: [fpc-pascal] Legitimate use of for and break

2023-06-21 Thread Steve Litt via fpc-pascal
wkitty42--- via fpc-pascal said on Wed, 21 Jun 2023 08:07:59 -0400 >On 6/20/23 10:54 PM, Steve Litt via fpc-pascal wrote: >> It was a long time ago, but if I remember correctly the >> Whitesmith Pascal and Turbo Pascal 2 and 3 had either break or >> continue. If I remember correctly, I first

Re: [fpc-pascal] Legitimate use of for and break

2023-06-21 Thread wkitty42--- via fpc-pascal
On 6/20/23 10:54 PM, Steve Litt via fpc-pascal wrote: It was a long time ago, but if I remember correctly the Whitesmith Pascal and Turbo Pascal 2 and 3 had either break or continue. If I remember correctly, I first learned about those when learning C. i'm confused about your statement...

Re: [fpc-pascal] Legitimate use of for and break

2023-06-20 Thread Steve Litt via fpc-pascal
Hairy Pixels via fpc-pascal said on Tue, 20 Jun 2023 14:05:04 +0700 >> On Jun 20, 2023, at 1:10 PM, Steve Litt via fpc-pascal >> wrote: >> >> 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

Re: [fpc-pascal] Legitimate use of for and break

2023-06-20 Thread Dennis Lee Bieber via fpc-pascal
On Tue, 20 Jun 2023 14:05:04 +0700, Hairy Pixels via fpc-pascal declaimed the following: > >Educators continuously have stupid ideas that don't work out as intended in >the real world. I would love to see them make a real program that does >something difficult and not use early breaks. > >I

Re: [fpc-pascal] Legitimate use of for and break

2023-06-20 Thread Giuliano Colla via fpc-pascal
Il 20/06/2023 09:05, Hairy Pixels via fpc-pascal ha scritto: Educators continuously have stupid ideas that don't work out as intended in the real world. I would love to see them make a real program that does something difficult and not use early breaks. I assume them they forbid early exits

Re: [fpc-pascal] Legitimate use of for and break

2023-06-20 Thread Hairy Pixels via fpc-pascal
> On Jun 20, 2023, at 1:10 PM, Steve Litt via fpc-pascal > wrote: > > 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. Educators continuously have stupid ideas

Re: [fpc-pascal] Legitimate use of for and break

2023-06-20 Thread Steve Litt via fpc-pascal
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

Re: [fpc-pascal] Legitimate use of for and break

2023-06-19 Thread Sven Barth via fpc-pascal
Am 18.06.2023 um 19:28 schrieb Travis Siegel via fpc-pascal: On 6/18/2023 1:04 AM, Hairy Pixels via fpc-pascal wrote: 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

Re: [fpc-pascal] Legitimate use of for and break

2023-06-18 Thread Travis Siegel via fpc-pascal
On 6/18/2023 6:53 AM, Bernd Oppolzer via fpc-pascal wrote: The compiler is a self-hosting compiler (like most Pascal compilers, I believe) and up to 2011 there were many exits from loops bye putting a label after the loop and using GOTO (because of the absence of BREAK). Similar use of GOTO

Re: [fpc-pascal] Legitimate use of for and break

2023-06-18 Thread Travis Siegel via fpc-pascal
On 6/18/2023 1:04 AM, Hairy Pixels via fpc-pascal wrote: 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. Use a variable, set the variable when you hit an exit

Re: [fpc-pascal] Legitimate use of for and break

2023-06-18 Thread wkitty42--- via fpc-pascal
On 6/17/23 2:07 PM, Travis Siegel via fpc-pascal 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,

Re: [fpc-pascal] Legitimate use of for and break

2023-06-18 Thread Bernd Oppolzer via fpc-pascal
Am 18.06.2023 um 03:04 schrieb Hairy Pixels via fpc-pascal: 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

Re: [fpc-pascal] Legitimate use of for and break

2023-06-17 Thread Tomas Hajny via fpc-pascal
On 2023-06-18 03:04, Hairy Pixels via fpc-pascal wrote: 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,

Re: [fpc-pascal] Legitimate use of for and break

2023-06-17 Thread Hairy Pixels via fpc-pascal
> 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,

Re: [fpc-pascal] Legitimate use of for and break

2023-06-17 Thread Martin Wynne via fpc-pascal
On 17/06/2023 19:07, Travis Siegel via fpc-pascal 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,

Re: [fpc-pascal] Legitimate use of for and break

2023-06-17 Thread Tomas Hajny via fpc-pascal
On 17 June 2023 20:45:49 +0200, Jean SUZINEAU via fpc-pascal wrote: >Le 17/06/2023 à 20:07, Travis Siegel via fpc-pascal a écrit : >> Is this a relatively new addition to fpc or something? > >I 've just found it in my Delphi 7 code (and code very likely written for >Delphi 4), so I think it's

Re: [fpc-pascal] Legitimate use of for and break

2023-06-17 Thread Jean SUZINEAU via fpc-pascal
Le 17/06/2023 à 20:07, Travis Siegel via fpc-pascal a écrit : Is this a relatively new addition to fpc or something? I 've just found it in my Delphi 7 code (and code very likely written for Delphi 4), so I think it's there since at least 2000-2001 ... May be it appeared with Delphi 1 ?

Re: [fpc-pascal] Legitimate use of for and break

2023-06-17 Thread Travis Siegel via fpc-pascal
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

Re: [fpc-pascal] Legitimate use of for and break

2023-06-16 Thread Mattias Gaertner via fpc-pascal
On Fri, 16 Jun 2023 20:51:42 +0700 Hairy Pixels via fpc-pascal wrote: > > On Jun 16, 2023, at 6:23 PM, Thomas Kurz via fpc-pascal > > wrote: > > > > Whether it's elegant is a different question. In my opinion YES > > because it often gives better readable code than nested "if" > > statements

Re: [fpc-pascal] Legitimate use of for and break

2023-06-16 Thread Hairy Pixels via fpc-pascal
> On Jun 16, 2023, at 6:23 PM, Thomas Kurz via fpc-pascal > wrote: > > Whether it's elegant is a different question. In my opinion YES because it > often gives better readable code than nested "if" statements inside the loop. > But I've also read that using "break" is discouraged because

Re: [fpc-pascal] Legitimate use of for and break

2023-06-16 Thread Thomas Kurz via fpc-pascal
I'm certainly not the expert in FPC's details, so maybe there'll you'll get a better answer. I just tell you my point of view. >> It's an array with a terminator >>string? Probably the length of the array should be set instead of >>doing string compares every loop. > > I need to set it in the

Re: [fpc-pascal] Legitimate use of for and break

2023-06-16 Thread Steve Litt via fpc-pascal
Hairy Pixels via fpc-pascal said on Fri, 16 Jun 2023 09:57:36 +0700 >> On Jun 16, 2023, at 6:07 AM, Steve Litt via fpc-pascal >> wrote: >> >> Is http://sprunge.us/MOJIg4 a legitimate use of a for loop with >> break? I know there are better ways to do it, but I'm just wondering >> whether it's

Re: [fpc-pascal] Legitimate use of for and break

2023-06-15 Thread Hairy Pixels via fpc-pascal
> On Jun 16, 2023, at 6:07 AM, Steve Litt via fpc-pascal > wrote: > > Is http://sprunge.us/MOJIg4 a legitimate use of a for loop with break? I > know there are better ways to do it, but I'm just wondering whether > it's legitimate. What are you trying to do exactly? It's an array with a

[fpc-pascal] Legitimate use of for and break

2023-06-15 Thread Steve Litt via fpc-pascal
Is http://sprunge.us/MOJIg4 a legitimate use of a for loop with break? I know there are better ways to do it, but I'm just wondering whether it's legitimate. SteveT Steve Litt Autumn 2022 featured book: Thriving in Tough Times http://www.troubleshooters.com/bookstore/thrive.htm