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

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