Ruby Ruby Loops Ruby Loops Loop Conditionals

Jake Schroeder
Jake Schroeder
5,610 Points

Question broken becasue string variable "e" does not exist.

It keeps saying the string variable e does not exist.

loop.rb
# Assume get_answer() is already defined
loop {
    answer = get_answer()

  if answer == e
    break
  end
}

1 Answer

Jennifer Nordell
STAFF
Jennifer Nordell
Treehouse Staff

Hi there, Jake Schroeder ! It looks to me like you're doing pretty well, but it's correct. There is no variable e defined. It's asking if the value of answer is equal to the string "e". Because you have omitted the quotation marks from around the "e", it believes e to be a variable storing a value. When it cannot find that variable, that error is the result.

So where you typed:

if answer == e

That should be:

if answer == "e"

Hope this helps! :sparkles: