Skip to content

Commit 5b14faa

Browse files
committed
Readme format tweak
1 parent d48bd37 commit 5b14faa

File tree

1 file changed

+5
-9
lines changed

1 file changed

+5
-9
lines changed

README.md

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -58,23 +58,19 @@ This function doesn't do anything meaningful, but hopefully it demonstrates the
5858
1. Invoke `stepsToZero(n)` where `n` is the number `2`
5959
2. Is 2 zero?
6060
3. No, print message to console that 2 is not zero
61-
4. `*`Invoke `stepsToZero(n-1)` where `n-1` evaluates to `1`
61+
4. Invoke `stepsToZero(n-1)` where `n-1` evaluates to `1`
62+
> Every recursive call adds a new invocation to the stack on top of the previous invocation
6263
5. Is 1 zero?
6364
6. No, print message that 1 is not zero
64-
7. `*`Invoke `stepsToZero(n-1)` where `n-1` evaluates to `0`
65+
7. Invoke `stepsToZero(n-1)` where `n-1` evaluates to `0`
6566
8. Is 0 zero?
6667
9. Yes, print message that reached zero
6768
10. Return out of the current invocation
68-
6. `**`Resume the invocation from step 4 where it left off
69+
6. Resume the invocation from step 4 where it left off (in-between steps 6 and 7)
6970
6. Return out of the invocation from step 4
70-
12. `***`Resume the initial invocation from step 1 where it left off
71+
12. Resume the initial invocation from step 1 where it left off (in-between steps 3 and 4)
7172
12. Return out of the initial invocation
7273
73-
74-
`*`Every recursive call adds a new invocation to the stack on top of the previous invocation
75-
`**`in-between steps 6 and 7
76-
`***` in-between steps 3 and 4
77-
7874
Due to the way the execution stack operates, it's as if each function invocation pauses in time when a recursive call is made. The function that pauses before a recursive call will resume once the recursive call completes. If you've seen the movie [Inception], this model may sound reminiscent to when the characters enter a person's dreams and time slowed. The difference is time doesn't actually slow with recursive invocations; rather, it's a matter of order of operations. If a new invocation enters the execution stack, that invocation must complete before the previous can continue and complete.
7975
8076

0 commit comments

Comments
 (0)