Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

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
seal-mask
STAFF
.a{fill-rule:evenodd;}techdegree
Jennifer Nordell
Treehouse Teacher

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: