Ruby Ruby Loops Ruby Loops Loop Conditionals

David Quiroz
David Quiroz
652 Points

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

David Quiroz
David Quiroz
652 Points

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

KRIS NIKOLAISEN
KRIS NIKOLAISEN
53,693 Points

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.

David Quiroz
David Quiroz
652 Points

ahhhhhh, that makes sense actually. Thank you