February 2019
Beginner
694 pages
18h 4m
English
Tuples are a method of defining a type that has a finite number of unnamed properties. Each property has an associated type. When using a tuple, each one of these properties must be provided. This can be best explained in an example, as follows:
let tupleType: [string, boolean]; tupleType = ["test", false]; tupleType = ["test"];
Here, we have defined a variable named tupleType, whose type is defined as an array of types, the first of which is a string, and the second of which is a boolean. We then assign a value to the variable tupleType, and are using an array syntax to set the first property to the string "test", and the second property to the boolean value false. Note that on the last line of this snippet, we are attempting to ...
Read now
Unlock full access