[fpc-pascal] Legitimate use of for and break
    Martin Wynne 
    martin at 85a.uk
       
    Sat Jun 17 22:46:21 CEST 2023
    
    
  
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, Perl, sure, even shell scripts, but pascal? Never 
> seen it used before.
I've been using break very often in Pascal loops for 25 years since 
Delphi 2. Also continue.
My code is littered with:
repeat
  do_something;
  if x then BREAK;
  if y then CONTINUE;
  do_something_else;
  Application.ProcessMessages;
  if key_clicked then EXIT;
until 0<>0;
ProcessMessages allows the user to stop the loop if it is running out of 
control.
Martin.
    
    
More information about the fpc-pascal
mailing list