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 trialSandy Woods
1,082 Points(String word : getWords())
the format of the method above is a bit unsettling. Is it a declaration and a method in one line? I'm just not quite sure how to appropriately wrap my brain around this.
2 Answers
Craig Dennis
Treehouse TeacherHi Sandy!
That is what is known as a for-each loop. Basically it's saying for each word in words perform this block of code. So yes it is essentially making a new locally scoped variable named word.
That help?
Sandy Woods
1,082 PointsFrom the Wizard of Oz himself. This definitely helped, thank you Craig!