December 2014
Beginner
300 pages
8h 9m
English
Did you notice in the preceding section that you don’t have mutable and immutable versions of the Swift array? Mutable means that something can be changed and immutable means it cannot be changed. An immutable array cannot change once it is created. Well, you really do have mutable and immutable versions of the array and every other variable, but you don’t need two different classes for each. To make an immutable array in Swift, you just assign it to a constant with let. If you want to make a mutable array in Swift, you just assign it to a variable using the keyword var:
var mutableArray = [1,2,3,4,5]let immutableArray = [1,2,3,4,5]
The following is a comparison of Swift ...
Read now
Unlock full access