Generic Structs
Structs can be generalized using type parameters to create reusable data structures. Type parameters are declared in angle brackets after the struct name, and can then be referenced in fields, method parameters, and return types.
Pair<T, U> stores two values of possibly different types. Type parameters are used throughout the struct definition: the field first has type T, the field second has type U, and method return types also use these type parameters. Concrete type arguments must be specified when instantiating.
Structs are value types, and instances are copied when assigned or passed as parameters. Two variables of type Pair<Int64, String> each have their own independent data, and modifying one does not affect the other. This differs from classes (reference types).
Pair<Int64, String> and Pair<String, Int64> are incompatible with each other.Run the example code, then change Pair<String, Int64> to Pair<Bool, Float64> and create a new instance.