On Fri, 16 Jun 2023 20:51:42 +0700 Hairy Pixels via fpc-pascal <fpc-pascal@lists.freepascal.org> wrote:
> > On Jun 16, 2023, at 6:23 PM, Thomas Kurz via fpc-pascal > > <fpc-pascal@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. 20 years ago there were some programmers, claiming a loop condition must only be at start or end, but not in the middle. Gladfully, most programmers came to their senses. Mattias _______________________________________________ fpc-pascal maillist - fpc-pascal@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal