Skip to content

Commit

Permalink
Explain why the step method is introduced in the snippets
Browse files Browse the repository at this point in the history
  • Loading branch information
Dobiasd committed Mar 20, 2024
1 parent 53f3602 commit f44b897
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions internals_of_the_async_await_pattern_from_first_principles.md
Expand Up @@ -24,8 +24,8 @@ function foo()
yield x

g = foo()
assert g.step() == 21
assert g.step() == 42
assert g.step() == 21 // Stepping the generator might look different in real languages.
assert g.step() == 42 // But to be explicit, our imaginary language provides this method.
```

In many programming languages, the above generator is internally (by the interpreter or compiler) converted to a state machine as follows:
Expand Down

0 comments on commit f44b897

Please sign in to comment.