5.5 Declaring Constants and Variables
Variables are declared using the var keyword and may be initialized with a value at creation time. If the variable is declared without an initial value, it must be declared as being optional (a topic which will be covered later in this chapter). The following, for example, is a typical variable declaration:
var userCount = 10
Constants are declared using the let keyword.
let maxUserCount = 20
For greater code efficiency and execution performance, Apple recommends the use of constants rather than variables whenever possible.