Skip to content

Instantly share code, notes, and snippets.

@jasonklein
Created April 11, 2014 12:53
Show Gist options
  • Save jasonklein/10466252 to your computer and use it in GitHub Desktop.
Save jasonklein/10466252 to your computer and use it in GitHub Desktop.
Pling Plang Plong by Hash
hash = {3=> "Pling", 5=> "Plang", 7=> "Plong"}
(1..100).each do |i|
if i % 3 != 0 && i % 5 != 0 && i % 7 != 0
puts i
else
hash.each do |number, drop|
if i % number == 0
print drop
end
end
end
puts
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment