-
-
Save campbecf/61132efbac5806b9d40c29bda4d1d4ec to your computer and use it in GitHub Desktop.
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
# frozen_string_literal: true | |
prompt = '--> ' | |
def test_user_input(number) | |
return "\n '#{number}' is an EVEN number. \n" if number.even? | |
" '#{number}' is an odd number. " | |
end | |
puts '' | |
puts 'Please enter a number, odd or even.' | |
puts '' | |
print prompt | |
number = gets.chomp.to_i | |
puts test_user_input(number) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment