Hello, in this video we are going to take a look at multi dimensional arrays. So what we have right here is a one dimensional array, because all you do is specify the indexing on like 01234, for example, and you just get it, it's just in a row essentially. So actually, I want to only be a representation of multi dimensional array. So if we go to images, as you can see, imagine that one of these is a an array like what we have now is one dimensional, you just go No, they're they're the they're multi, the multi dimensional array, like a 2d array will have a row and you'll have a column. So this could be great if you're trying to represent you know, a grid of information. Maybe you have a 2d game and you will represent in the players position exposition and and a wide collision.
So the way you would create a two dimensional array is by having an array inside of an array. So you do, right. And I want to keep it simple with the amount of value that I'm going to be using for the principal sense on say one, comma two, we're going to use numbers, this is a little easier to type it out. And I'm going to have a number array three comma 415. So if we want to actually see Yeah, let's see what happens. If we usually do the array name, square bracket zero, we will get the first element in the array.
So let's see what happens if we do that. We get a rate string conversion. It's a notice no problem with this. All right. He gives us an array What it is actually returning to us, we want to access the next element in the index, or you know, because this whole thing returns an array, or we can do is do this. So if I do zero here, we get the value one, because this right here will return this.
And if we have an array and we put zero discuss the first value, if I do one, for example, that will return the second value. And if I was to change this to a one, for example, this will go to index one of this top array that is 01. Then you'll go into this array and find index one. So this is 01. So we'll return a value of four. Another way to sort of visualize it is that if we print all on one line, so we have the first one refers to the row, the second one Refer to the columns.
And really that's that is all there is that you need to know regarding multi dimensional arrays, you can have a made dominions if you want, you can have three dimensions. So there'll be an array inside of an array inside of an another array. And you can have any sort of values in there. They don't have to be regular raised like this. They can be associative arrays. So as an extra task, I want you to modify the array.
Watch out. If you haven't watched the associative array video, first, check that out. Use the information from there, modify this. So it's an associative array. And yeah, there you go. So the multiple use cases for this, like I said, one could be, you know, representing a grid of information, it could be like a game.
For example, it could be used for matrices, in mathematical calculations, the whole bunch of stuff. If you have any questions, feel free to pop me a message. And as usual, I look forward See you in the next video.