Welcome back to intermediate visual basic. This is the third course in the Introduction to Computer Programming with Visual Basic specialization. In this last module of this third course, we want to focus on collections. Collections give us the ability to store multiple values in a single variable, essentially a collection of values. Some learning objectives here. When you're done with this module, I want you to be able to implement a one-dimensional array in Visual Basic. I want you to then be able to iterate through that array so you can see every value in the array. Then I want you to be able to implement multidimensional arrays in Visual Basic. Lastly, use some higher-level data structures such as a list in Visual Basic. In this first lesson, we're going to start simple with one-dimensional arrays. The syntax for declaring a one-dimensional array, there's several different forms. We can declare, initialize a one-dimensional array in one statement. Essentially we say dim, the array name, and the upper bound in parentheses as a type. We can also declare but not initialize a one-dimensional array. We could say delete dim, array name with just parentheses as type. That's not going to allocate memory. Then we can initialize on its own line with a new operator. Remember, we saw the new operator when we instantiated classes in the last module. Same idea here. It's going to create memory on the heap to handle our array. Now, we can do that as a single line with that dim array name, parentheses with the upper bound as type in the beginning. When we want to reference an element, we can do so with the parentheses in the index. Just like we saw earlier, with characters in a string, the index starts with zero and goes up to the length minus one. Here's an example. I have an array called my grades. I'm going to instantiate it on the same line where I say 10. That's going to create the ability to store 10 integers in the array called my grades. I can then reference the first grade by saying my grades open parenthesis, zero, close parenthesis. I can reference the last one by saying my grades open parenthesis, nine, end parenthesis. It's always going to start with zero to go to length minus one. There's a shortcut for creating and assigning values in one statement. Essentially, I have an example here. I have the syntax above, but the example is my friends. I'm only got three friends, that's an array of strings. I can use the squiggly brackets and put the elements right there. You'll see, I have three friends, Fred, Sally, and Bill are string literals and this is an array of strings. It's going to essentially create an array of three elements called friends. There is a length property on the array that tells me how many. I can then use that in a for statement. Here's an example where I declare my friends and I instantiate with by literals Fred, Sally, and Bill and then I iterate with a variable. I have my for loop that we learned earlier where I'm going to say For I as integer equals zero to friends dot length minus one, and then in my console, I'm just going to write out the friends sub I. Just a little review for this lesson, arrays are fixed-size collections of the same data type in one variable. What I mean by that is you can't change the size. If I say I have 10 grades like I said earlier, the only way to change that size would be to create a new array of a different size and copy all that data, they're fixed. They all have the same data type. They're either strings or integers or whatever the type is. The length property tells you the number of elements in the array. Then remember, this is an important one, array elements are indexed from zero to the length minus one. See you in the next lesson.