Yes, that code is perfect. Indeed, your last assignment would override any previous assignment effectively making the first 3 lines do nothing.Originally Posted by chronozphere
The scoping would be a problem because the following piece of code would be syntactically identical as your initial piece of code
[pascal]
function Angle(X,Y: single): single;
begin
Result := 0;
if X = 0 then
begin
if Y > 0 then
Result := 180
end
else
Result := 0;
Result := 180+RadToDeg(Arctan2(-X,Y));
end;[/pascal]
Bookmarks