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?

This would probably be better:
[pascal]
function Angle(X,Y: single): single;
begin
if X = 0 then
begin
if Y > 0 then Result := 180
else Result := 0;
end else
Result := 180+RadToDeg(Arctan2(-X,Y));
end;
[/pascal]