Created
May 22, 2012 06:14
-
-
Save kachick/2767000 to your computer and use it in GitHub Desktop.
昔お勉強したこと - たしか一番最初に書いたfizzbuzz
This file contains hidden or 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
| def fizzbuzz(start, last) | |
| (start..last).each do |i| | |
| if i%15 == 0 | |
| puts 'FizzBuzz' | |
| else | |
| if i%3 == 0 | |
| puts 'Fizz' | |
| elsif i%5 == 0 | |
| puts 'Buzz' | |
| else | |
| puts i | |
| end | |
| end | |
| end | |
| end | |
| fizzbuzz(1,100) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment