I cant get this to work? else branch


#1



print "Hackney Downs"
user_input == gets.chomp
user_input.downcase!
if user_input.include? "s"
user_input.gsub!(/s/, "th")
else
   puts "There are no s's here!"
end


#2

Don't have double equal signs. (user_input = gets.chomp.downcase)

This is what your code should look like:

print "Hackney Downs"
user_input = gets.chomp.downcase!
if user_input.include? "s"
user_input.gsub!(/s/, "th")
else
puts "there are no s' here!"
end

You have to have an Upper Case letter in your string so that .downcase! has something to return, otherwise it stuffs up the .include method.

Hope this helps. :wink:


#3

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