Created
June 3, 2017 17:34
-
-
Save 27Cobalter/971094344bc08ab7e5eb2f43b015225d to your computer and use it in GitHub Desktop.
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
class Hoge | |
def fuga(var) | |
if var%15 == 0 then | |
return 15 | |
elsif var%5 == 0 then | |
return 5 | |
elsif var%3 == 0 then | |
return 3 | |
else | |
return var | |
end | |
end | |
end | |
Fifteen = 15 | |
Five = 5 | |
Three = 3 | |
myon = Hoge.new | |
for num in 1..100 do | |
case myon.fuga(num) | |
when Fifteen then | |
puts "FizzBuzz" | |
when Five then | |
puts "Buzz" | |
when Three then | |
puts "Fizz" | |
else | |
puts num | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment