Skip to content

Instantly share code, notes, and snippets.

@alpinegizmo
Forked from phillipoertel/The Foobar Test.rb
Created October 28, 2009 15:12
Show Gist options
  • Select an option

  • Save alpinegizmo/220529 to your computer and use it in GitHub Desktop.

Select an option

Save alpinegizmo/220529 to your computer and use it in GitHub Desktop.
#
# a smoke test to check basic programming skills
#
# Task:
# - print out the numbers 1 to 100
# - output "foo" for every number divisible by 3
# - output "bar" for every number divisible by 5
# - output "foobar" for every number divisible by 3 and 5
#
(1..100).each do |number|
print "#{number} "
print 'foo' if (number % 3) == 0
print 'bar' if (number % 5) == 0
puts
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment