Created
July 8, 2009 15:02
-
-
Save idesaku/142903 to your computer and use it in GitHub Desktop.
100以下のフィボナッチ数を表示する
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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