 Hi, guys. In this video, we're going to be talking about multi-dimensional arrays. So, a multi-dimensional array is basically just an array of arrays. And for our purposes, we're just going to be focusing on two-dimensional arrays, which are declared like so. And these two-dimensional arrays consist of an outer array containing inner arrays, like a collection of collections. So, when we want to allocate memory to a multi-dimensional array, we do so by first giving the size of the outer array, just like so, and then giving the size of all the inner arrays. So, here we have multi-D array, which is an array of three arrays, each of which contains two elements. And this array is stored in memory like so. So, first we have multi-D array, which references a chunk of memory, which in turn holds references to our three inner arrays. And the actual integer values within our arrays are stored in the secondary chunks of memory, like so. So, whenever we want to access a particular value within multi-D array, we require two values. The value of the outer array and the value of the inner array. For example, this item here can be accessed at multi-D array 1, 0, because it is the item at index 0 in the second outer array. Now, in order to traverse over the items inside a multi-dimensional array, we need nested loops. So, let's head over to processing to see how this works. Alright, so you can see here I've declared multi-D array, just like we saw earlier, and allocated memory. And then underneath here, I've written a nested for loop. What this is going to do is it's going to loop through every item in multi-D array. And it's going to set every item to the value i plus 1, where i is the counter of the outer loop here. And then we're just going to print out each item as we set it. So, I think the best way to see how this works is to move into debug mode and step through this loop bit by bit, so that we can clearly see how we're looping through and accessing each item in our array. So, let's go ahead and move to debug mode and we've got a lot of breakpoints there. They're awesome, so let's go ahead and start running this. Alright, so at first we have multi-D array, and you can see that the debugger displays it like this as an integer array containing three arrays. And then if we expand each of the three arrays, we can see obviously they each contain two items, indexes 0 and 1, and each item at first is just set to the default value of 0. Now, we are going to start looping through our outer array, so you can see at first i is set to 0. Now we're going to step through to our inner array, j is set to 0. And you can see that now we're going to keep looping through our inner array as long as j is less than multi-D array i.length. So, as long as j is less than the length of our first inner array. So, we step through and you can see now we've set multi-D array 0, 0 to i plus 1, which is 1. And then we're going to just step through again. You can see j's gone up by 1. We set multi-D array 0, 1 to 1. And now we're going to keep going through. So now we're about to exit our inner loop. Yes, we've gone back to our outer loop, i now equals 1. And now we're going to keep doing the same thing. We're going to be setting these two items to i plus 1, which will be 2. So you can kind of see what's happening. We're using the outer loop to loop through our outer arrays here, sort of the unnested part here, these three. And then the inner loop within the outer array is looping through these two items and setting them, just like that. So we can just keep stepping through. You can see in the debugger the values are changing until we exit the loop. And then you can see down here as well, we've just been printing the values as we go. And then once i becomes greater than multi-D array dot length, we're going to exit the loops. So there we go. And the program will terminate. And now all of the values have been set within our array. So hopefully that just gave you a clearer picture of how you can loop through a multi-dimensional array to access each item. By using an outer loop to access the outer array and an inner loop to access the inner arrays. So that was just a quick video on multi-dimensional arrays. So I hope you found it helpful and thank you for watching. Bye.