Last active
August 29, 2015 14:09
-
-
Save mosdevly/e0368b3f06482518837f to your computer and use it in GitHub Desktop.
Create a method that will print out the numbers 1-50. If the number is a multiple of 7, make it print out a string instead.
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
def skipMultiples | |
i = 0 | |
range = (2...50).to_a | |
while i < range.length | |
if range[i] % 7 != 0 | |
puts range[i] | |
else | |
range[i] = "Love conquers all!" | |
puts range[i] | |
end | |
i += 1 | |
end | |
end | |
skipMultiples |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment