Skip to content

Instantly share code, notes, and snippets.

@mindplace
Created March 22, 2016 14:45
Show Gist options
  • Select an option

  • Save mindplace/e3f4b48ba8d2fbc398ed to your computer and use it in GitHub Desktop.

Select an option

Save mindplace/e3f4b48ba8d2fbc398ed to your computer and use it in GitHub Desktop.
def fizzbuzz(max)
(1..max).to_a.each do |num|
current = ""
current << "Fizz" if num % 3 == 0
current << "Buzz" if num % 5 == 0
current<< num.to_s if current.empty?
puts current
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment