Tsallaka zuwa abun ciki
Justice Tech School

Swift Arrays

An array is an ordered list of one type. Use append, insert, remove, count, first, last and contains. Arrays are value types and copied on assignment.

Example
var fruits = ["apple", "banana"]
fruits.append("cherry")
fruits.remove(at: 0)
print(fruits, fruits.count)
print(fruits.contains("banana"))

Exercise

Add an item.

list.("x")

Quiz Test

Are arrays reference or value types?

These free lessons are for learning. Join a full course for projects, mentor feedback and a verified certificate.