Most of the operators we have been using on other types, like mathematical operators ( +, %, etc.) and comparison operators (==, >, etc.), do not work on structures. (It is possible to define custom operators, but we wonβt worry about that yet.)
On the other hand, the assignment operator does work for structures. It can be used in two ways: to initialize the instance variables of a structure from a list of values or to copy the instance variables from one structure to another. An initialization looks like this:
The values in squiggly braces get assigned to the instance variables of the structure one by one, in order. So in this case, x gets the first value and y gets the second.
It is important to note that an assignment makes a copy of a struct. Once the assignment has been made, changing one struct has no effect on the other. This Codelens demonstrates by coping a struct and then changing one of the copies.