Skip to content

Instantly share code, notes, and snippets.

@manojmj92
Last active January 23, 2019 07:29
Show Gist options
  • Save manojmj92/7a7eaa8bd0aef7cfff9faa78670b293b to your computer and use it in GitHub Desktop.
Save manojmj92/7a7eaa8bd0aef7cfff9faa78670b293b to your computer and use it in GitHub Desktop.
fibonacci = Enumerator.new do |sequence|
a = b = 1
loop do
sequence << a
a, b = b, a + b
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment