+ 2
The lesson specifies that Swift allows multiple *declaration,* but what about multiple *assignment?*
Many modern languages allow one to assign to multiple variables in a single statement - e.g. something along the lines of `var a, b, c = 1, 2, 3;` The Swift variable lesson discusses the fact that it's possible to *declare* multiple variables in a single statement - `var a, b, c;` - but doesn't mention assignment. Is this possible, also? (And yes, there is in fact a non-trivial distinction between declaration and assignment in the language specification.)
2 odpowiedzi
+ 3
As far as I know, Swift definitely allows for that!
To declare several variables on one line, you would need to declare each variable and assign them a value separately before the comma, similar to if you were just assigning one variable:
var a = 1, b = 2, c = 3;
Hope this helped! d:
+ 2
That's the syntax I would have expected, thanks!