Lesson 7 Thith Meanth WAR!


#1

Hi Coders,

Could you guys please tell me what the issue causing my code below could be?

print "Enter character name"
user_input = gets.chomp
.downcase!

if user_input.include? "s"
print "Name has an s"
user_input.gsub!(/s/ , "th")

else user_input.include? "s"
print "This name has no s"

end

print "Adios, #{user_input}!"

its really fustrating D:

Thanks guys!


#2

HI try to remove the conditon to the else statement

else user_input.include? "s"
print "This name has no s"

user_input.include? "s"


#3

print "Enter character name"
user_input = gets.chomp
.downcase!

if user_input.include? "s"
print "Name has an s"
user_input.gsub!(/s/ , "th")

else user_input.include? "s"

puts "Nice name {#user_input)!"

end

Still no luck D: error message "undefined method `include?' for nil:NilClass"


#4

HI it should be like that

print "Enter character name"
user_input = gets.chomp.downcase!

if user_input.include? "s"
    print "Name has an s"
    user_input.gsub!(/s/ , "th")

else   #here I removed the condition to the else statement
    puts "Nice name {#user_input)!"
end

#5

This works great now thank you. Realized I do not need to put the condition twice :slight_smile: My brain is still adjusting to talking like a machine xD