Exercise 4 doesn't work properly


#1
print "Why do you bother me? "
if gets.chomp.downcase!.include? "s"
    print "nice s"
end

I get an error "undefined method `include?' for nil:NilClass"
What's the problem?


#2

To chain commands together, the previous one must return something to the next.

downcase! doesn't need to return anything because its goal is to directly modify the content, that's why it returns nil, and that's why it's telling you that you can't call the include? method on a nil object.

You can use downcase without the ! instead, it should work.