Skip to content

Instantly share code, notes, and snippets.

@beatmadsen
Created January 23, 2020 01:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save beatmadsen/10715761ebd13e740313aa3b9d36c782 to your computer and use it in GitHub Desktop.
Save beatmadsen/10715761ebd13e740313aa3b9d36c782 to your computer and use it in GitHub Desktop.
An example of how fibers work
f = Fiber.new do
a = 42
loop do
Fiber.yield(a)
a += 1
end
end
f.resume # => 42
f.resume # => 43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment