Not clearing past variables properly


#1


So I noticed this error farther back but it never really caused an issue until now. It doesn't seem that the website is clearing variables after the code is run. I would make a prompt and input a variable, the rest of the code would run but it would use a variable I had input the last time i ran the program.

i.e
run1 variable = pasta
run2 variable = pizza

but it would runt the code as if I had just input "pasta" instead of the word pizza.

I'm now trying to complete this course and its telling "undefined local variable or method `user_input' for #"

I've already cleared my cache and also tried a new browser but the issue persists.


print " Pleathe type wordth here: "
variable_user_input = gets.chomp
user_input.downcase!
if user_input.include? "s"
    user_input.gsub!(/s/, "th")
end


#2

In the code that you've shown us, you haven't defined a variable called user_input.

variable_user_input is not the same variable name as user_input.


#3

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