May 2019
Beginner to intermediate
466 pages
10h 44m
English
While looking at the response header, you might've noticed that its type is an Array of Pair objects:
julia> resp.headers
25-element Array{Pair{SubString{String},SubString{String}},1}
A Pair represents a Julia data structure—and the corresponding type. The Pair contains a couple of values that are generally used to reference key-value relationships. The types of the two elements determine the concrete type of the Pair.
For example, we can construct a Pair with the following:
julia> Pair(:foo, "bar") :foo => "bar"
If we check its type we'll see that it's a Pair of Symbol and String:
julia> typeof(Pair(:foo, "bar"))
Pair{Symbol,String}
We can also create Pairs by using the x => y literal notation:
julia> 3 => 'C' 3 => ...
Read now
Unlock full access