In the previous example, we have discussed how to retrieve the Triple values using the variable name? There is another way which is using properties, with the help of some predefined properties we can easily get the Triple values.
Properties:
In Kotlin Triple, we can use the properties named "first", "second", and "third" to retrieve the values of Triple. The "first" property stores the first value of the Triple, the "second" property stores the second value, and the "third" property stores the third value.
Syntax:
pair_name.first
pair_name.second
pair_name.third
Example 1:
Output:
Example 2:
Output:
need an explanation for this answer? contact us directly to get an explanation for this answer