Skip to content

Commit ee509e3

Browse files
authored
Merge pull request aspittel#7 from maxburn/patch-1
Updated Tail Recursion example
2 parents 7a3bb84 + 1fe3399 commit ee509e3

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

fundamentals/recursion.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,9 @@ Tail recursion is where calculations are performed first and then the recursive
2828

2929
```python
3030
def factorial(n, running_total=1):
31-
if x <= 1:
31+
if n <= 1:
3232
return running_total
33-
return factorial(x-1, x * running_total)
33+
return factorial(n-1, n * running_total)
3434
```
3535

3636
## Practice Problems

0 commit comments

Comments
 (0)