Thith Meanth War!


#1



https://www.codecademy.com/courses/ruby-beginner-en-JdNDe/0/4?curriculum_id=5059f8619189a5000201fbcb#


undefined local variable or method `string_to_check' for #


Replace this line with your code. 
print "Wanna be Daffy Duck? Just input a sentance!"
user_input = gets.chomp
user_input.downcase!
if string_to_check.include? "s"
    print "For now my friend..."
end


#2

string_to_check is not defined. You never set that variable. You want to check to see if what the user input has any S's in it.


#3

Thanks I just got past that part but I'm stuck again at the very end, here is the code. For some reason the else statement isn't running...

print "Wanna be Daffy Duck? Just input a sentance!"
user_input = gets.chomp
user_input.downcase!
if user_input.include? "s"
user_input.gsub!(/s/, "th")
else
puts "How can you sound like Daffy if their aren't any S's to change?!?"
end

puts "Working.... Changing S's to th's.... Please hold.... Ah here we go! #{user_input}"


#4

The else statement runs fine for me when I input a string with no S's.


#5

Oh wait, now I see it... Huh.... That looks a bit weird, well thanks for the help. I'll spruce it up and finish it.


#6

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