[fpc-pascal] Legitimate use of for and break
tsiegel at softcon.com
tsiegel at softcon.com
Sat Jun 17 20:07:08 CEST 2023
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?
On 6/16/2023 1:51 PM, Hairy Pixels via fpc-pascal wrote:
>
>> On Jun 16, 2023, at 6:23 PM, Thomas Kurz via fpc-pascal <fpc-pascal at lists.freepascal.org> 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 it shows a bad choice of the loop range.
> This is highly suspect. Doing an early break in loops is the essence of how to do linear searching. No idea who thinks that's a bad idea.
>
> Regards,
> Ryan Joseph
>
> _______________________________________________
> fpc-pascal maillist - fpc-pascal at lists.freepascal.org
> https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
More information about the fpc-pascal
mailing list