Task

Show how to return more than one value from a function.




include c:\cxpl\codes;          \intrinsic 'code' declarations
 
proc Rect2Polar(X,Y,A,D);       \Return two polar coordinate values
real X,Y,A,D;
[A(0):= ATan2(Y,X);
 D(0):= Sqrt(X*X+Y*Y);
]; \Rect2Polar
 
real Ang, Dist;
[Rect2Polar(4.0, 3.0, @Ang, @Dist);  \("@" is a new feature similar to 'addr')
RlOut(0, Ang); 
RlOut(0, Dist); 
CrLf(0);
]