A Function with a State and Resumed Value

Learn how the function behaves with a state and when resumed with a value.

A function with a state

If a function has some state (like local variables or parameters) that we need to restore after suspension, this state needs to be kept in the function’s continuation. Let’s consider the following function.

Get hands-on with 1200+ tech skills courses.