Getting User Input Issue


#1

This is my code:

print "Thtrong"
user_input=gets.chomp
user_input.downcase!
if user_input.include? "s"
user_input.gsub! (/s/, "th")
else
print "no s"
end
puts "#{user_input}"

These are the errors I get:
(ruby):4: syntax error, unexpected ',', expecting ')'
user_input.gsub! (/s/, "th")
^
(ruby):4: syntax error, unexpected ')', expecting keyword_end

What should be fixed?


#2

The mistake is the space you added after .dgub! method in line 5


#3

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