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 trialJames Nelson
23,956 Pointsretry if
I am watching along Jason's Ruby Foundations, control flow video.
I have a loop the following loop -
animals = %w(dog cat horse goat snake frog) count = 0
for animal in animals puts "The current animal is #{animal}" break if count == 10 count += 1 retry if animal == 'horse' end
When I try to run this I get a SyntaxError on the retry if line. I have compared with Jason's code and it appears to be the exact same. Could someone spot the problem?
Thanks
2 Answers
Jason Zaluski
9,412 PointsSeems like others are having same issue. https://teamtreehouse.com/forum/invalid-retry-and-compile-error-syntaxerror
James Nelson
23,956 PointsYeah I see this Jason, must be something to do with an updated version or Ruby. Thanks for you're reply