Tuples are one of the simplest data types and data structures in Julia. They can have any length and can contain any kind of value—but they are immutable. Once created, a tuple cannot be modified. A tuple can be created using the literal tuple notation, by wrapping the comma-separated values within brackets (...)
:
(1, 2, 3) julia> ("a", 4, 12.5) ("a", 4, 12.5)
In order to define a one-element tuple, we must not forget the trailing comma:
julia> (1,)
(1,)
But it's OK to leave off the parenthesis:
julia> 'e', 2
('e', 2)
julia> 1,
(1,)
We can index into tuples to access their elements:
julia> lang = ("Julia", v"1.0")
("Julia", v"1.0.0")
julia> lang[2]
v"1.0.0"
Vectorized dot operations also work with tuples:
julia> (3,4) .+ (1,1) (4, 5)