.include? issues


#1



I actually got all the way to section 13 before I got the .include? error message, in other words, the program had no issues with it before and now that I've gone back and retyped it repeatedly (and even after watching a youtube tutorial) I still don't know what I'm doing wrong... Although I'm sure its likely painfully obvious.

https://www.codecademy.com/en/courses/ruby-beginner-en-JdNDe/0/4?curriculum_id=5059f8619189a5000201fbcb#

Error message: undefined method `include?' for nil:NilClass


print "test drive. vroom, vroom."
user_input = gets.chomp.downcase!
if user_input.include? "s"
    print "SSSS in the house"
end


#2

@terasolver15241
Try using

gets.chomp.downcase

without the so-called Bang-sign

Reference
google search
== discussions / opinions ==
ruby downcase with bang site:stackoverflow.com
http://stackoverflow.com/questions/709229/difference-between-downcase-and-downcase-in-ruby/709241#709241


#3

it worked! Thank you!


#4

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