Michael Van Canneyt via fpc-pascal wrote:


On Sat, 16 Dec 2023, Adriaan van Os via fpc-pascal wrote:


More questions about the FreePascal Language Reference (version 3.2.0), part 4

34. Are macpas LEAVE and CYCLE statements undocumented ?

Yes.

Well, according to Appendix D.6 of the Programmer's Manual, CYCLE is equivalent to CONTINUE and LEAVE to BREAK. Contrary to the information presented there, the CYCLE and LEAVE statements have been implemented for macpas mode.

I don't see BREAK and CONTINUE in the syntax diagrams either. I put together some examples (stressing that I am not a proponent of these C constructs).

procedure test;
begin
  while true do leave;
  writeln( 'leave makes true=false');

  while true do break;
  writeln( 'break makes true=false');

  writeln( 'cycle forever');
  while true do begin cycle; leave end;

  writeln( 'continue forever');
  while true do begin continue; break end;
end;

36. Is the macpas RETURN statement undocumented ?

In MetroWerks Pascal, we have

        return-statement = "RETURN" [ expression ] .

In a procedure the [ expression ] part is skipped, in a function it assigns the function-result and then jumps to the end of the function. In a procedure, it just jumps to the end of the procedure. FreePascal allows RETURN in macpas mode to be used in a function only, so the following compiles only in a function.

 repeat return until false;
  writeln( 'the point of no return');

Ceterum censeo C esse delendam.

Regards,

Adriaan van Os

_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Reply via email to