Skip to content

Instantly share code, notes, and snippets.

@maehrm
Created May 10, 2011 12:47
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 maehrm/964407 to your computer and use it in GitHub Desktop.
Save maehrm/964407 to your computer and use it in GitHub Desktop.
fiberを使ってフィボナッチ数列
def fib
a, b = 0, 1
Fiber.new do
loop do
Fiber.yield b
a, b = b, a + b
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment