
iOS 15 Programming for Beginners
By :

Let's say you want to store the following:
Arrays would be suitable for this. An array stores values in an ordered list. Here's what it looks like:
Figure 5.1: Array
Values must be of the same type. You can access any value in an array by using the array index, which starts with 0
.
If you create an array using the let
keyword, its contents can't be changed after it has been created. If you want to change an array's contents after creation, use the var
keyword.
Let's see how to work with arrays. You'll create an array by assigning a value to it in the next section.
In previous chapters, you created a constant or variable by declaring it and assigning an initial value to it. You can create an array the same way.
Imagine that your spouse has asked you to get some items from a convenience...