Swift賦值表達式
賦值表達式(Assignment Operator)
The assigment operator sets a new value for a given expression. It has the following form: 賦值表達式會對某個給定的表達式賦值。 它有如下的形式;
expression
=value
就是把右邊的 value 賦值給左邊的 expression. 如果左邊的expression 需要接收多個參數(是一個tuple ),那麼右邊必須也是一個具有同樣數量參數的tuple. (允許嵌套的tuple)
(a, _, (b, c)) = ("test", 9.45, (12, 3))
// a is "test", b is 12, c is 3, and 9.45 is ignored
賦值運算符不返回任何值。
賦值運算符語法
賦值運算符 → =