Setting Up The "If" Branch, Part 2


Hey I'm on setting up the "if" branch, part 2 and its not working.


Here is the code I'm using:

print "Type the word that has a S in it"
user_input = gets.chomp
if user_input.include? "s" then
user_input.gsub!(/S/, "th")
print "That word included the letter S!"
print user_input
print "That word did not included the letter S!"
print user_input


Your code is correct, lower case the S between

/S/ and enter smooth as the word. Works like a charm!

Probably should make sure that your word STARTED with an S....


It worked thank you very much


Can you make mine the solution real fast? That way everyone knows that it was solved. Thanks :wink:

Glad you got it working haha!


The phrase may be seeded with s's throughout, not just the beginning.

This may be nil if there are no upper case letters in the inputs. Write,

user_input = user_input.downcase

to ensure that the text remains in tact.