Mai I ask for help in understanding recursion

I can not understand recursion it seems completely different than anything before

2 Likes

Hey there! I highly recommend checking out the “Get Help” button that offers some hints.

Here’s another article I found through there.

In short, with recursion, we’re defining a function that calls itself. In order to prevent this from being done infinitely, we define a circumstance or “base case” where that inner calling stops.

Hope this helps!

3 Likes

Hi @hamzanouh2689314

Did you figured out? I am sending you a couple of links you could read to get a better understanding of it, I hope:

https://eloquentjavascript.net/03_functions.html

Its like a family tree: first it resolves the last case with the last possible parameter. The value returned for last case is used to resolve the case before that, and so on, going up, till first case. Tricky english, sorry, lol
Good luck

till now I cannot grasp and write it

1 Like

Hi @hamzanouh2689314

Dont worry some thing it takes time, speak about it with someone it helps too, never mind if they know about the topic. Its just like thinking aloud.
This post has a few graphic examples. last one its really good. Check it out. I hope it helps.

Good luck and dont be too hard with yourself some features . Dont check a problem more than 10 min, go to do other thing, walk, run, doesnt mater,… just disconnect, youll figure it out for sure.