Created
April 15, 2019 00:23
-
-
Save NoMan2000/3baa57dd4672243016dc4ccbeadbca92 to your computer and use it in GitHub Desktop.
A simple ruby program
This file contains 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
p "How many items do you want?" | |
input = gets.to_i | |
(1..input).each do |n| | |
if n % 15 == 0 | |
p "FooBar" | |
elsif n % 3 == 0 | |
p "Foo" | |
elsif n % 5 == 0 | |
p "Bar" | |
else | |
p n | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment