December 2018
Intermediate to advanced
414 pages
10h 19m
English
There is a simple method to access tuple values. Take, for example, the size pair, as follows:
let size = (width: 200, height: 400)let (w, h) = sizelet (width, _) = size
In the preceding example, we initialize a tuple on the first line. On the second line, we destructure both parameters as w and h. On the last line is what we call a partial destructuring: when you're only interested in one part of the tuple, you can extract only a part of it. This is useful when dealing with large tuples.
Read now
Unlock full access