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, sure, even shell scripts, but pascal? Never seen it used before.  Is this a relatively new addition to fpc or something?

the Break keyword first appeared in Turob/Borland Pascal 7.0 along with the Continue keyword... to refresh my memory, i searched the various reference manuals for TP/BP versions... the first one that did not have "break" as part of CheckBreak, CBreak, and similar was TP/BP 7.0...


http://bitsavers.informatik.uni-stuttgart.de/pdf/borland/turbo_pascal/Turbo_Pascal_Version_7.0_Language_Guide_1992.pdf

page 86:

If the number of repetitions is known beforehand, the for statement is the appropriate construct. Otherwise, the while or repeat statement should be used.

The Break and Continue standard procedures can be used to control the flow of repetitive statements: Break terminates a repetitive statement, and Continue continues with the next iteration of a repetitive statement. For more details on these standard procedures, see Chapter I, "Library reference," in the Programmer's Reference.


http://www.bitsavers.org/pdf/borland/turbo_pascal/Turbo_Pascal_Version_7.0_Programmers_Reference_1992.pdf

page 15:

Break procedure                                           System
-------------------------------------------------------------------------
       Purpose   Terminates a for, while, or repeat statement.

   Declaration   procedure Break;

       Remarks   Break exits the innermost enclosing for, while, or repeat
                 statement immediately. Break is analogous to a goto statement
                 addressing a label just after the end of the innermost
                 enclosing repetitive statement. The compiler reports an error
                 if Break is not enclosed by a for, while, or repeat statement.

      See also   Continue, Exit, Halt

       Example
                 var S: string;
                 begin
                   while True do
                   begin
                     Readln(S);
                     if S = '' then Break;
                     Writeln(S);
                   end;
                 end.




--
 NOTE: No off-list assistance is given without prior approval.
       *Please keep mailing list traffic on the list where it belongs!*
_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Reply via email to