Tuples

A tuple in Cairo allows us to group multiple values with a variety of types into a single element with a fixed length that can’t be changed after its declaration.

Tuples can be declared with or without specifying the type of each element in the tuple, and deconstructed during or after their declaration.

Example

fn main() {
    let tup: (felt252, bool) = (8, false);
    let (a, _) = tup;
    let (b, _) = (8, false);
    assert!(a == b);
}

You can experiment with this example in cairovm.codes and read more about tuples in the Cairo Book.