# I don't get recursion

**URL:** https://forum.kirupa.com/t/i-dont-get-recursion/195251
**Category:** flash
**Created:** [July 30, 2006, 3:19am UTC](https://forum.kirupa.com/t/i-dont-get-recursion/195251 "2006-07-30T03:19:08Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![Al6200](https://avatars.discourse-cdn.com/v4/letter/a/f19dbf/32.png) [@Al6200](https://forum.kirupa.com/u/Al6200)
#### Post date: [July 30, 2006, 3:19am UTC](https://forum.kirupa.com/t/i-dont-get-recursion/195251/1 "2006-07-30T03:19:08Z")

</div>

Well, I’ve seen a lot of places talking about the technique, and citing codes like:

factorial = function(n) {  
factorial(n-1);  
}

I don’t understand the concept of calling a function within itself. What precisely does this accomplish, and how is it legal? Shouldn’t the function definition fail because while its being defined its calling a function that does not yet exist.

Also, what problem could be solved by recursion?
