Setting Up the 'If' Branch, Part 2


#1

Guys,could you help with that block of coding.

Task is When we find "s", we want Ruby to replace every instance of "s" it finds with "th". We can do this with the .gsub! method, which stands for global substitution.

My solution:
print "Please input smth"
user_input=gets.chomp
if user_input.include?( "s")
user_input.gsub!(/th/,"s")
end

but the error occurs:
Oops, try again. Make sure you're using .gsub! to replace every 's' with 'th'.


#2

You want to find "s" and replace it by "th", not the other way around.