官术网_书友最值得收藏!

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.

主站蜘蛛池模板: 砀山县| 潼南县| 洛浦县| 通榆县| 遂溪县| 观塘区| 浮山县| 建湖县| 乐山市| 壶关县| 石景山区| 徐闻县| 济源市| 汶川县| 武平县| 军事| 彭州市| 浪卡子县| 屯门区| 辰溪县| 社旗县| 林西县| 乡城县| 苏尼特右旗| 天水市| 洮南市| 黄冈市| 科尔| 含山县| 全州县| 灵山县| 峡江县| 万山特区| 宝清县| 资中县| 巩义市| 义马市| 湖北省| 扶绥县| 新昌县| 遂溪县|