A Tuple is typically created with a tuple literal:
tuple = {1, "hello", 'x'} # Tuple(Int32, String, Char) tuple[0] # => 1 (Int32) tuple[1] # => "hello" (String) tuple[2] # => 'x' (Char)
To create an empty tuple use Tuple.new.
To denote a tuple type you can write:
# The type denoting a tuple of Int32, String and Char Tuple(Int32, String, Char)
In type restrictions, generic type arguments and other places where a type is expected, you can use a shorter syntax, as explained in the type grammar:
# An array of tuples of Int32, String and Char Array({Int32, String, Char})
To the extent possible under law, the persons who contributed to this workhave waived
all copyright and related or neighboring rights to this workby associating CC0 with it.
https://crystal-lang.org/docs/syntax_and_semantics/literals/tuple.html