Skip to content

Instantly share code, notes, and snippets.

@justindossey
Last active August 29, 2015 14:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save justindossey/af71bbe1d343706fb0d7 to your computer and use it in GitHub Desktop.
Save justindossey/af71bbe1d343706fb0d7 to your computer and use it in GitHub Desktop.
fizzbuzz ruby like puppet
matches = {
[true, true] => 'fizzbuzz',
[true, false] => 'fizz',
[false, true] => 'buzz'
}
(1..100).each do |num|
results = [num % 3 == 0, num % 5 == 0]
puts matches[results] || num
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment