Recursion help or help with procedure result

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?

Are you asking for such a function?
blocks - 2021-01-14T220632.821

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)

you can do this, but it is still only one return value...
see also this example

and don't hesitate do do a search in the community...


Trying to push the limits! Snippets, Tutorials and Extensions from Pura Vida Apps by icon24 Taifun.


1 Like