4. Setting Up the 'If' Branch, Part 1


My code doesn't seem to work. When I go to submit and type something in, I get an error message. Can anyone help please?

print "ask user input"
user_input = gets.chomp
if string_to_check.include? "s"
   print user_input "yes"


As expected, the exercise tells us to use .downcase! but doesn't advise that there must be at least one capital letter, else user_input is nil.

You can either,

  1. Enter some text with a capital letter in it; or,
  2. Change the code to,

    user_input = user_input.downcase

The above doesn't change the input if no uppercase letters are found.


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.