Last active
June 23, 2016 22:27
-
-
Save drbrain/94c38425fdf3ef92f03c38920d932083 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
numbers = (1..100).to_a | |
numbers.each do |n| | |
div_5 = n.divmod(5).last.zero? | |
div_7 = n.divmod(7).last.zero? | |
message = | |
if div_5 and div_7 then | |
"foo" | |
elsif div_7 then | |
"baz" | |
elsif div_5 then | |
"bar" | |
else | |
n | |
end | |
puts message | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment