CodeWarrior-style 'return <value>' statement
Original Reporter info from Mantis: FPCCore
-
Reporter name: FPC core team
Original Reporter info from Mantis: FPCCore
- Reporter name: FPC core team
Description:
(The following applies only to Mode MacPas)
CodeWarrior allows for immediate exit of a procedure and function using the 'return' key word (mich like the 'Exit' keyword).
However, for functions, Codewarrior also allows to return the function result. Thus
function foo : integer
begin
return 3;
end;
is analoguous to
function foo : integer
begin
foo := 3;
Exit(foo);
end;
Although not clean, it allows for very simple, one-statement guards, e.g.
if myPtr = nil then
return cNoMemErr;
Additional information:
Reporter: christian franz
EMail: cfranz at access dot ch
Mantis conversion info:
- Mantis ID: 6158
- OS: Mac OS X