Created
October 22, 2010 16:31
-
-
Save pbalduino/640898 to your computer and use it in GitHub Desktop.
1, 2, 3, pim! 5, 6, 7, pim!
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
class Integer | |
def multiplo_de_quatro? | |
self % 4 == 0 | |
end | |
def pim! | |
multiplo_de_quatro? ? "pim!" : "#{self}" | |
end | |
end | |
(1..20).each {|numero| puts numero.pim! } | |
puts 32768.pim! # pim! | |
puts 17.pim! # 17 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment