Defining Structs
A struct is a collection of named fields used to organize related data together. Each field has a name and a type. Fields declared with let are immutable, while fields declared with var are mutable.
Access fields using dot notation, such as point.x. Fields can have default values specified at definition time or passed in during construction.
The code on the right defines two structs: Point and Book. The fields of Point are declared with let, so they cannot be modified after creation. For Book, title is an immutable field, while pages is a mutable field.
Note
A struct can only be defined at the top level of a source file and cannot be nested inside other types or functions.
Try adding a year field of type Int64 to Book and print it in main.