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 trialBrenda Bouchard
5,028 PointsLoop Conditionals Challenge Task 1 of 1
I am not sure what to do
# Assume get_answer() is already defined
1 Answer
jordans
1,609 PointsStart and end the loop:
loop do
end
Now, assign the value of the get_answer() method to the variable "answer". You can put either get_answer() or get_answer:
loop do
answer = get_answer
end
And last, break the loop with an if statement if the variable "answer" is equal/comparable ("==") to the string e. Make sure you define e as a string by wrapping it in single quotes (the apostrophe character):
loop do
answer = get_answer
break if answer == 'e'
end
Michael Kristensen
Full Stack JavaScript Techdegree Graduate 26,251 PointsMichael Kristensen
Full Stack JavaScript Techdegree Graduate 26,251 PointsThank you - I kept running in circles because I thought the task asked for
answer
to be compared to a string in a variable namede
, and so not adding the quotation around'e'