I'm just curious as to why the following occurs:
If my code is like the following:
print "Type in a string pleaaassee:" user_input = gets.chomp.downcase! if user_input.include? "s" print "It contains an 's'" else print "Does not contain an 's'" end
Then I get the following error:
Type in a string pleaaassee: s undefined method `include?' for nil:NilClass
But if I change the following line:
user_input = gets.chomp.downcase!
user_input = gets.chomp user_input.downcase!
Then it works just fine.. Can someone explain why?