def polar(x,y) theta = Math.atan2(y,x) # Compute the angle r = Math.hypot(x,y) # Compute the distance [r, theta] # The last expression is the return value end distance, angle = polar(2,2)