I dont know whats wrong with my code!


#1

Im a beginner and i cant figure out where i went wrong in the code...i simply cant get an output!

Every time i execute i recieve an error msg saying the if block has an error.

print ( "enter your string:" )
user_input=gets.chomp
user-input.downcase!
if user_input.include? " s "
    user-input.gsub!(/s/,"th")
end
else 
    puts "no S"
end


#2

HI remove the end before the else statement


#3

Remove the end in the middle of the if statement.

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:


#4

I think the problem is that you are referring to your variable 'user_input' as 'user-input' (with a dash instead of an underscore) in several places.


#5

good spotting! If they use both our help, they will get it.


#6

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