Bummer! This is just a preview. You need to be signed in with a Basic account to view the entire video.
For Each0:56 with Craig Dennis
A shorthand version used for looping through an enumeration completely
So, the for-each loop to the rescue.
Again, useful when you wanna process everything in a list or in an array.
Every time you wanna process through everything.
It's definitely more legible and you want to use this.
If you see the old loop looping over an array, convert it,
make it more readable, right?
Again, in other languages sometimes this is called a for-in loop or
an enhanced for-loop.
So, let's just go really quick and we'll do the for-each.
We'll switch that over, I want you back, Jackson old school.
Was a Jackson five joke, it fell flat.
They always do.
All right, so I'm gonna grab this over here.
So, I'm gonna write this string, Jackson and Jackson's,
and then I can get rid of this right here.
I think everybody kinda understands what's going on there.
You need to sign up for Treehouse in order to download course files.Sign up