Skip to content

Commit 1fe3399

Browse files
authored
Updated Tail Recursion example
Updated Tail Recursion example to use 'n' in the function as defined by the signature. Before it was using 'x'.
1 parent 7a3bb84 commit 1fe3399

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)