Creating a mutable array

It is a best practice to make all arrays (and, for that matter, collections) immutable, but there are some cases where you will need to create an array that is mutable. Let's have some fun and create a mutable array:

var states:[String] = [] 

As an aside, when creating a mutable array (or any variable), note that each variable must be unique.

One use of a mutable array is so that we can add to the array. Let's look at some ways in which we can do this.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.191.135.224