6.1 Expression Syntax in Swift
The most basic Swift expression consists of an operator, two operands and an assignment. The following is an example of an expression:
var myresult = 1 + 2
In the above example, the (+) operator is used to add two operands (1 and 2) together. The assignment operator (=) subsequently assigns the result of the addition to a variable named myresult. The operands could just have easily been variables (or a mixture of constants and variables) instead of the actual numerical values used in the example.
In the remainder of this chapter we will look at the basic types of operators available in Swift.