Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

Ruby Ruby Loops Ruby Loops Loop Conditionals

Getting an odd Error on Ruby loop challenge

working on the following question Using a loop construct, assign the value of the get_answer() method to an answer variable. Use the break keyword to exit the loop if the answer variable is equal to the string e. Assume get_answer() is already written

and I am getting the following error: Bummer: Errno::ENOENT: No such file or directory @ rb_sysopen - 1

when entering in the following loop: loop do answer = gets.chomp.downcase break if answer == "e" end

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

2 Answers

answer = gets.chomp.downcase is looking for input from the user. That's not what the challenge asks you to do. The instructions are to assign the value of the get_answer() method to an answer variable. That is why answer = get_answer works.

ahhhhhh, that makes sense actually. Thank you

seems to be a problem with treehouses library? see last comment on this thread https://teamtreehouse.com/community/ruby-loop-get-answer-loop-not-working