Skip to content

Instantly share code, notes, and snippets.

@Leejojo
Last active June 21, 2016 23:03
Show Gist options
  • Select an option

  • Save Leejojo/bd20e69d9085393cb35e105de6f302b9 to your computer and use it in GitHub Desktop.

Select an option

Save Leejojo/bd20e69d9085393cb35e105de6f302b9 to your computer and use it in GitHub Desktop.
FizzBuzz
def fizzbuzz_value(i)
if i % 15 == 0
puts "FizzBuzz"
elsif i % 5 == 0
puts "Buzz"
elsif i % 3 == 0
puts "Fizz"
else
puts i
end
end
def fizzbuzz (start, endval)
start.upto(endval) do |i|
puts fizzbuzz_value(i)
end
end
fizzbuzz(18, 88)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment