Skip to content

Instantly share code, notes, and snippets.

@mosdevly
Last active August 29, 2015 14:09
Show Gist options
  • Save mosdevly/e0368b3f06482518837f to your computer and use it in GitHub Desktop.
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.
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