Result

Inside Methods with a return value, the result expression can be used to refer to the result that the method will return upon completion.

result acts like a variable of the same type as the method's return type, and will be initialized to that type's default value (nil for reference types, and 0 or the equivalent for value types) as the method starts. result can be both assigned to and read from.

method Test: Integer;
begin
  result := 15;
  ...
  if result > 30 then
    ...
    
  ...
end;

See Also