Skip to content

Instantly share code, notes, and snippets.

@idesaku
Created July 8, 2009 15:02
Show Gist options
  • Save idesaku/142903 to your computer and use it in GitHub Desktop.
Save idesaku/142903 to your computer and use it in GitHub Desktop.
100以下のフィボナッチ数を表示する
# 100以下のフィボナッチ数列を表示する。
# tap使いたいだけちゃうんかと。
puts [1,1].tap { |x|
loop do
v = x[-2] + x[-1]
break if v > 100
x << v
end
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment