Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
class Fixnum
define_method(:pingpong) do
1.upto(self).each do |number|
ping = (number % 3 == 0)
pong = (number % 5 == 0)
if ping && pong
puts "PingPong"
elsif ping
puts "Ping"
elsif pong
puts "Pong"
else
puts number
end
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.