re: Intro to Recursion in JS VIEW POST


Great read, just one thing I would like to point out:

1) You can solve any problem without Recursion, so it is often looked over for beginners.

Maybe it's beside the point, but there are actually some things that cannot be solved without recursion, an interesting video on this:


The Ackermann function is indeed not "primitive recursive." However, it is computable, and therefore can be computed with loops. A while loop would work for example.

If you only have a for item in items type of loop where items cannot be changed inside the loop, that would not be good enough to compute the Ackermann function though.

It's easy to get confused with this stuff, but anything that you can implement with a computer program can be done without recursion. You can think of it this way: Hardware doesn't support recursion in the actual electronics (at least I don't think so), yet code in any programming language can be compiled down to machine language that's executed by the hardware.

Code of Conduct Report abuse