Quote Originally Posted by chronozphere
Yeah, in general the scoping of that snippet could result in different pieces of code on different compilers Razz

Looks like it's been converted directly from C code Smile
Can you elaborate a little more on this? Is it because i allready assigned a result before the last statement is executed?

[ code ]
Yes, that code is perfect. Indeed, your last assignment would override any previous assignment effectively making the first 3 lines do nothing.

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]