Setting Up The "If" Branch, Part 2


#1

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

HELP

Here is the code I'm using:

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


#2

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....


#3

It worked thank you very much


#4

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

Glad you got it working haha!


#5

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.