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 trialLeonardo Cavalcanti
5,308 Pointsloop doesnt work, first ruby loop assignment quiz
numbers = [] variable=0 loop numbers+=[1] variable=numbers.length if variable==3 break end end number = 0
write your loop here
Not sure why im getting this error
rb:9: syntax error, unexpected keyword_end, expecting end-of-input
waiting for some help.
numbers = []
variable=0
loop
numbers+=[1]
variable=numbers.length
if variable==3
break
end
end
number = 0
# write your loop here
1 Answer
Katie Russ
6,775 PointsYou need to either use the do
and end
keywords or use curly braces around your block; in your case, you are missing the do
after loop
on line 3.
Leonardo Cavalcanti
5,308 PointsLeonardo Cavalcanti
5,308 PointsYeah, simple mistake, sorry for taking your time but i was struggling and couldnt find anything wrong... pretty dumb of me eh
Katie Russ
6,775 PointsKatie Russ
6,775 PointsWhen you stare at something long enough, it gets hard to see even "simple mistakes." An extra set of eyes always helps!