[fpc-pascal] Legitimate use of for and break

tsiegel at softcon.com tsiegel at softcon.com
Sun Jun 18 19:28:37 CEST 2023

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 criteria, then 
before repeating the loop, check the variable, if it's true, exit the 
loop (exit does this), or just craft the loop (easy to do if it's a loop 
until construct) so it exits the loop automatically.  Probably not as 
efficient as break, but since I didn't know it was a valid command, <shrug>

More information about the fpc-pascal mailing list