A tuple type is defined similarly to a tuple expression. For example, given two types
(a, b) represents a tuple that consists of an element of type
an element of type
b. For example
(felt, felt) may be used to represent a
Cairo also supports named tuples, for example
(x: felt, y: felt) represents a tuple similar
(felt, felt) except that the two items are named x and y, respectively.
User-defined type aliases¶
You can give a new alias for a type as follows:
using Point = (x: felt, y: felt);
Point is not a new type in this case – it is only an alias to
(x: felt, y: felt).
You can use
Point as an alias for this type.
For example, you may replace
local pt: (x: felt, y: felt) = (x=2, y=3);
local pt: Point = (x=2, y=3);