I want to write a factorial routine using recursion but don't understand the procedure result block.
essentially i want to see if n=1 then return 1 else return n*f(n-1)
i am going crazy trying to do this in appinventor syntax. can anyone give a quick example?
thanks!
Are you asking for such a function?
Sort of. That is a factorial function but I am trying to write it with recursion and not a loop.
Can I have two result returns in a function? want to write essentially
function fac(n)
if n==1 return 1
else return n*fac(n-1)
Taifun
January 14, 2021, 9:35pm
4
you can do this, but it is still only one return value...
see also this example
I ran into some trouble crossing the equator of the tank, and had to improvise. I couldn't find any formula using arcsin, so I used arccosine formulas, which were accompanied by good explanations.
https://www.mathsisfun.com/geometry/cylinder-horizontal-volume.html
works up until the equator (yielding negative area over the equator), so I flipped the problem (water<==>air) for height > radius,
coming up with a recursive formula.
I skipped the part where you convert from cubic centimeters (cm…
and don't hesitate do do a search in the community...
Taifun
Trying to push the limits! Snippets , Tutorials and Extensions from Pura Vida Apps by Taifun.