Arrays
Store several values in one variable.
1let fruits = ["apple", "banana", "cherry"]
2print(fruits)
$ swift main.swift
["apple", "banana", "cherry"]
Every line, explained
let fruits = ["apple", "banana", "cherry"]- An array stores several values in one variable. The values go between square brackets, separated by commas.
print(fruits)- print(...) shows whatever is inside its round brackets in the terminal, then moves to a new line. All lowercase, both brackets needed, and no semicolon at the end; Swift doesn't use them. Printing an array shows all its items between square brackets, each String in its quotes.