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 trial

CSS

@each loop, no pre-defined list

For the @each example with the band members, what would you do in a situation where the "members" are not constant, like a store's employee's or any sort of dynamic content where you might not know their names ahead of time? Would this be beyond the scope of these lessons, or require additional languages?

1 Answer

Tim Knight
Tim Knight
28,888 Points

It really depends, if the band members were coming out of a database you'd approach this differently and not use Sass to generate those details (most likely). I think with the band member example it's really just serving as a teaching exercise.

Here's an article that I wrote back in 2014 that talks about some other practical uses of using @each to iterate over a list.

https://medium.com/developing-with-sass/practical-sass-loops-eb442a4b0f19