DEV Community

loading...

Discussion on: What is Recursion?

Collapse
donut87 profile image
Christian Baer

The first two code examples are not identical in function, as you can see from the output. So the first script cannot be 're-written' to the second code.

Collapse
bahe007 profile image
Bastian Heinlein

Yes, however, it‘s just a small problem: Simply use „>=“ instead of „>“ in the loop or a do-while-loop.