Array is a collection that stores data of the same type in order. You can use arrays to store things like product lists, menu items, todo tasks, or lesson titles. Array indexes start at 0.
swift
var lessons = ["Intro", "Variables", "Arrays"]
print(lessons[0])
lessons.append("Functions")
for lesson in lessons {
print("Lesson: \(lesson)")
}
print("Total lessons: \(lessons.count)")lessons[0] grabs the very first item. append() adds a new item, and a for-in loop walks through each item in the array.
You should see
Intro Lesson: Intro Lesson: Variables Lesson: Arrays Lesson: Functions Total lessons: 4