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

Nick Hennen
Nick Hennen
7,812 Points

I'm not sure what this question wants me to do.

loop.rb
# Assume get_answer() is already defined
loop do
  answer = gets.chomp
  puts "type e"
  if answer = "e"
    break
  end
end

1 Answer

Maciej Czuchnowski
Maciej Czuchnowski
36,441 Points

Your code is too specific and comparison is used in a wrong way. But looking at how the question is formulated, I can understand your confusion. This is the minimum working code for this challenge:

loop do
  answer = get_answer()
  if answer == "e"
    break
  end
end
Nick Hennen
Nick Hennen
7,812 Points

Your code worked, thank you. Even if I correct if answer = "e" to if answer == "e" it doesn't work. This may be because I am being too specific but I'm not sure how I did that. I get the error Errno::ENOENT: No such file or directory @ rb_sysopen - 1. How did I cause that?

Maciej Czuchnowski
Maciej Czuchnowski
36,441 Points

No idea how the challenge system and grader work under the hood :)