Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2009-04

Return Statement

2 messages · 2 people ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Richard Ward

My last post got me thinking about weaning myself from macpas mode. One of the statements I have found quite useful is the macpas defined "return" statement which is used to return the function value and exits immediately from inside any nested block. Has there been any thought or discussion about incorporating "return" into the main language? For me, it simplifies writing functions considerably and makes the code easier to read/understand - even if it just replaces a simple function assignment statement at the end of the function. - R

This
   ...
   return x;
end;
vs this
   ...
   funcname := x;
end;
Mattias Gaertner
to Richard Ward
Show quoted text 19 lines
My last post got me thinking about weaning myself from macpas mode. One of the statements I have found quite useful is the macpas defined "return" statement which is used to return the function value and exits immediately from inside any nested block. Has there been any thought or discussion about incorporating "return" into the main language? For me, it simplifies writing functions considerably and makes the code easier to read/understand - even if it just replaces a simple function assignment statement at the end of the function. - R This ... return x; end; vs this ... funcname := x; end;

exit(x); can be used in mode objfpc.

Mattias