I am starting to enjoy many features of Julia. I just haven’t found the best way to provide an optional return value. Lets say we have a function (improvised not compiled)
function myAlg(x::Float,y::Float)
    if x > y
        z=y;
        reason="A";
    else
        z=x;
        reason="B";
   end
   return z,reason
end
where reason is an additional return value that might provide more information but is not a result per se.
What is the best way to make that reason optional?
My first idea would be function myAlg(x::Float,y::Float; returnReason=false)
and a
if returnReason
    return z,reason
else
    return z
end
but is that type stable and intended that way?
Is there a better and nicer way to only get the reason returned if I explicitly ask for it?
What’s the best practice for such a szenario?
Kind Regards,
Kellertuer
