R
Robert.Koepferl
Hi,
does ruby have a syntax or some way to tell it to use end recursion.
I tried to write a recoursive factorial function (to test BigNum). However
the stack is limited (of course).
def fak(z)
return 1 if z<=1;
z* fak(z-1) if z>1;
end
in some languages it's possible "to return first and then invoke the last
instruction"
Not that I need it, I'm just interested.
does ruby have a syntax or some way to tell it to use end recursion.
I tried to write a recoursive factorial function (to test BigNum). However
the stack is limited (of course).
def fak(z)
return 1 if z<=1;
z* fak(z-1) if z>1;
end
in some languages it's possible "to return first and then invoke the last
instruction"
Not that I need it, I'm just interested.