 Hello guys, Crypto Grounds here. Welcome back to another C Sharp Crash video. This is episode 11. Today we're going to be doing arrays. If you enjoyed this video, don't forget to leave a like, subscribe to my channel if you're new, and turn on notifications for future videos. And also check out my other tutorial videos and other stuff with the icon in the corner. Let's get on with it. So today I'm going to show you what are arrays, how they work, and how to declare them, and other ways you can declare them. So I've shown you in the past videos on, like I've briefly mentioned arrays obviously, but I want to go kind of more in depth in this video. So there are a few main ways of declaring them. So we can obviously just have it like this in our main method, we can just do an array equals new int since this is an int array, right? int array with the size of two, we can have it like this, or we can put this up here, whatever you'd like. Now, I prefer doing it down here because you're basically just starting it with a brand new array. Well, that's up to you. So if we have a size two array, it will look something like this, you'll have two values at index zero and one, and both will be set to zero. Let's say we want to change the first index. And also the reason why it doesn't go to two is because it's zero based. So we have one and two, but it's zero and one instead. Okay. Hopefully that makes sense. Now let's say you want to change it. All you got to do, which I've shown in the past, is do an array, we're just putting your array variable zero equals five, something like that. That's all you need to do. And so this is a good way to reset your array. So if you've made changes and you want to reset the array, you can just do new int array size two. Okay, so another way of defining it is by doing new brackets, curly brace, and we can say we want our own stuff in here. So the thing here, I didn't I didn't put the type in here. Why? It's because these are ints, right? If we change this to a float array. Okay, okay, so I accidentally pause the video. So I'll and I as I kept writing, but let's say we change our into a float array. Now in here, we have to add our float to here, because if this didn't exist right here, we're trying to make an int array because these are ints, their whole numbers, into it's trying to create that in array into a float array. That just doesn't work. So you have to have the you have to have the float term in it, you got to have the keyword in it. Alright, it works the exact same way as a regular as a regular like int array, string array, something like this. So now, I'm going to show you something a little more complicated. So let's say we have a class. Let's say in here we have a variable called I'm going to make it public because we want to change it in our main class, we're going to do public int b. Okay, so now we can make arrays for our classes to we do this by doing public a array. And we're just going to call it a class array. And now in here, we can do that's such a long name though. I'm just going to call it a C a for a class array, because that's so long. I don't want to write it all out. But basically in here, we can just do a C a is equal to new like this. My apologies, these are actually switched. Because we're making an array with the constructor methods in here. So if we have a constructor in here, we can put our define we can put our default stuff in here. And let's say we want this to make we want to make it a size two. Okay, so now in here, we can do a C a say we want to access B, what we do is we put the index we want to access, and then we do dot B, and we can set it equal to or for example, just like that. Okay, so let's say we want to pre define our arrays just like how we were doing with the curly, the curly braces. So now in here, we can do it makes a little organized, you can just do curly brace here, curly brace here. And then what we can do is I'm going to have to scoot these down is in here, we can have a list of new, get rid of this, we can do new a right here. Now we can put our constructor stuff in here, and say we don't want everything to be the exact same right, we can just put whatever you want in here. Now I don't have a constructor, but I hope that makes sense. I'm gonna just do another new a just like that. Okay. Now of course, we can't pre define variables like this in here, you have to either do that in a constructor, or you just got to do it on the outside, right? Okay, that's it for this video. If you enjoyed this video, don't forget to leave a like, subscribe to my channel if you're new and turn on notifications and check out my other videos on the icon in the corner, comment down your suggestions or anything you'd like below. I'll be sure to check them out. Anyways, thank you for watching. Peace.