Skip to content

Instantly share code, notes, and snippets.

@kylekeesling
Created November 6, 2015 15:38
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 kylekeesling/4523d06719e6284cc80f to your computer and use it in GitHub Desktop.
Save kylekeesling/4523d06719e6284cc80f to your computer and use it in GitHub Desktop.
(1..1000).each do |number|
if number % 7 == 0
puts "#{number} is divisible by 7"
end
end
@kylekeesling
Copy link
Author

This example uses the each loop on a range to find all numbers between 1 and 1000 that are divisible by 7

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment