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 trialJuan Ordaz
12,012 PointsDon't understand the instructions.
Instructions are confusing...Is say assign the value of the method to the variable "answer", and I did it at the beginning, so I am just confuse..
# Assume get_answer() is already defined
loop do
answer = ""
answer = get_answer
print "Enter (e) to exit the loop"
answer = gets.chomp
if answer == "e"
break
end
end
1 Answer
Michael Prince
23,132 PointsJuan,
Your code above is almost correct, you just have an extra line that you don't want. The first line of your loop is assigning to the variable answer
an empty string. The second line of the loop is assigning the variable answer
the value of the get_answer()
method. Then on the fourth line of your loop you are changing the value of the variable answer
again with answer = gets.chomp
Remove that fourth line and your code will pass.