 Hey everybody, this is Brian and welcome to the eighth C-sharp tutorial. We're going to just open up a console application. Today we're going to discuss the forEach. It's very similar to the for loop we discussed in the last tutorial, but forEach says for each item in an object. Remember everything in .NET is an object. Objects can be made of other objects. So we're just going to say string. Whoops, if I could spell it right. String and we're going to say name. And we want to say equals, you know, whatever your name is. So now we have a variable called name. Notice how the greens quickly means it's not being used. So this variable name is assigned, but it's never used. Now what we're going to do is forEach, care, see, in, name. So what we're simply doing is saying for each character, remember character is a type, in name. Name is a string. A string is a series of characters. Each one of these letters is a character. Then we're just going to do console.rightLine and then see because we're going to print out each character and then console.read just so we can keep our window open. Press f5 to run. And sure enough, b-r-y-a-n. We printed out every character in our string. So the forEach is similar to the forLoop, but it's different. It's different in the sense that it does a lot of the heavy lifting for you. You could have written this like for int i equals zero, i less than, we'll see here, name.length. Notice how name is a variable, but we are actually using it as an object. That's what I mean by everything in .NET as an object. You can use the name.length to get the length of the string name. And then we'll just say console.rightLine and then bracket, zero bracket. Now what we're doing here is you see how we're saying care string int index. What we're doing is saying get the index of that string. Remember we talked about zero based on the last tutorial. The first one is zero. Second is one, two, three, four. So let's actually just print this out here. We'll say i plus and let's run this. Then we have zero, one, two, three, four. Notice how it's only grabbing the b. Well the reason why is we put a zero here. If we put this i here, then we're grabbing that current index. Remember to be zero through the length. So it's going to say zero, one, two, three, four. Don't get thrown off by the fact that it's starting at zero. There's actually five letters there. We're going to prove that by f5 to run and you see it says zero b, one r, two y, three a, four n. So that is how you do a four loop and that is how you do a four each loop. Very simple. All the four each does is it takes care of all of this for you. So you don't have to worry about any of this gobbledygook. It's much, much easier just say four each type in object. Very simple, very easy. This is Brian. I hope you found this tutorial educational and entertaining and thanks for watching.