org.sonar.l10n.delphi.rules.community-delphi.PascalStyleResult.html Maven / Gradle / Ivy
The newest version!
Why is this an issue?
In Delphi, function results should be assigned to the special Result
variable.
While function results can be assigned to the function identifier, as in earlier versions of
Pascal, this approach is no longer recommended as it can be confusing.
How to fix it
Assign the function result to the Result
variable instead of the function identifier:
function GetFoo: TFoo;
begin
GetFoo := TFoo.Create;
end;
function GetFoo: TFoo;
begin
Result := TFoo.Create;
end;
Resources
© 2015 - 2024 Weber Informatics LLC | Privacy Policy