iOS 12 Programming for Beginners
上QQ阅读APP看书,第一时间看更新

Creating an empty array

Now let's create a few arrays in Playgrounds.

Sometimes, you may want to remove your prior entries from your Playground so that it is easier for you to see each new print statement. Do that now and input the following:

We just created our first two arrays. The reason for two different syntaxes is because you can create it in two different ways. Regarding the first example, you will see me create arrays throughout this book.

The data types within each set of brackets tells Swift what type of array we want to create. The first array (integers) we created has a data type of ints, and our second array (strings) has a data type of strings.