Variable
A variable
is a value that can be changed.
To declare a variable simply put var
in front of the variable name:
var player: String = "Henrik Larsson"
Change player
by setting its value to another of the correct type:
player = "Chris Sutton"
If you declare an object as a variable and do not change it, Xcode will warn prompt you to change the variable to a constant.
Related articles:
< All Posts