All right, two dimensional arrays. In Unit 8 on Runestone for reasons I'm not exactly sure about, the pages are broken up a little bit differently. All of 8.1 is actually going to be broken across two pages, one that goes from 8.1.1 to 8.1.4, and then one that goes from 8.1.5 to the end. I'm going to organize the videos that way just so that you are reminded of that [LAUGH] when you jump into it tomorrow, because it'll look a little different. Maybe that'll change in the future and I'll regret this decision, but you never know. The key thing you really need to know as a teacher about 2D arrays, they behave just like 1D arrays. In all the ways that they are tricky, AP CSA doesn't cover and honestly are not the most important things to learn. So there's actually a lot of stuff in here that you can completely skip. And I'll give you some hints about that and a few extra tips and images to help you with your students. So the beginning of 8.1.1 is great, introduces that we're bringing back an image we've seen before, which is a row of lockers that we introduced to introduce arrays. And we say, you know what, if you are used to the way at least some lockers are done in US schools, there can actually be rows and columns. There's high, medium, and low and they're stacked on top of each other and all that sort of good stuff. So this is a really cool image about that. And the key thing is, as they say, you can actually only hold one item in each array element. You can't smash as many things into it as you want, but same idea. And they did point out that there's a lot of really good game related and real-world related things that have 2D arrays, like battleship and bingo games and spreadsheets and theater seats and classroom seats and pixels in a picture, which we're going to work on later. This section on array storage really students do not need to know. AP CSA and really much any intro programming courses, we always assume row major order for array storage. If you don't know what row-major order is, it doesn't matter, that's okay. And let me tell you, I used to work in supercomputing. I think maybe once I worked in column-major order. I'm not even sure that happens anymore. So anyway, I'm just telling you, the only diagram that's important here is this one that I have a check mark by. That basically says your rows are 0 and 1, there on the left, and your columns are columns 0, 1, 2. Row-major order is just basically the same way we all draw things. So and maybe an extra helpful image that relates to that one is to go back to the lockers and be like, so here is the indexes or the rows and the columns for that locker. So maybe you want to have kids do that and draw that, see if they can remember it starts at 0, right, okay. This entire section, nope, don't need it. You do not need to know how they store it underneath in the computer. We don't teach our kids this in university, skip it. But in that section, there are some good problems that you can do five of them that are really cool and they basically say hey, here's a two dimensional array of things. Click on all the values in the row at index 2. Did you remember? That we don't start counting at 1,we start count at 0. I'm sorry, just mentally change that to a 0 in your head, right? So all the ones at 2, 0, 1, 2. Those are the ones you would want to click on. All right, 8.1.4. Again, this is a fine paragraph. It's all correct, it's all true, students need to know this. But basically you could just say 2D arrays work just like arrays, ta dum dum. The only thing I'll say here is they're asking if you create a 2D array but you don't actually instantiate, if you just declare it, it will have the value null in it. Yeah, neh, we don't really care that much and I don't think that would be tested. So there you are. But this one could use a few more visuals, I think, to really make it clear. So let's say we declare a 2D array called ticketInfo = new int [2][3] and a seatingChart = new String [2][3], how are those different? Well, here's the images you'd want to see. TicketInfo is going to be two rows and three columns and seatingChart is going to be three rows and two columns. Either way, they actually both have the same number of elements in that and they say how many elements are in ticketInfo? The key is you multiply 2 times 3, 6. And again, if you're drawing the boxes, it's pretty obvious. Finally in this particular code activity, they're just basically having you run the code to show how do you print out. When we had a 1D array, we had the length, right? And that was how many elements were in our array. Well, now if you print out length, that's going to tell you how many rows there are. And if you print out ticketInfo[0], so the first element, it's like, that's going to tell you how many columns. And kids will forget this and they'll be like, why does it? Don't understand the why, okay? Just give them the following cheat to remember it. This is how we all do it. For the shorter instruction, that gives you the shorter word. Rows is a shorter word than columns. So ticketInfo.length, that's shorter than ticketInfo[0].length. Okay, so that's short. It gives you the number of rows. The longer instruction, ticketInfo[0].length, that gives you columns. Now, you could say, why use sub 0, could I use sub 1? In this case, and in AP CSA, you can because they always guarantee that the the two-dimensional array is a rectangle, okay? It's not going to be something called a ragged array. Again, we hardly ever use those. Don't worry about them. Even if you're not teaching AP CSA, just stick with the rectangles, okay? So you can use any number, it turns out, that's a legit index into your row. So ticketInfo[0], just tell them to always use [0] and that'll get them the columns. So again, shorter gives you rows. Longer gives you columns.