Suppose I define the function f(x)
as follows:
function f(x)
if true
g(x) = 2x
else
g(x) = 3x
end
g(x)
end
To me it was very surprising that calling f(2)
returns 6 instead of 2. Can someone explain this behavior?