educative.io

Destructuring Triple in kotlin

fun getFullName() = Triple("a", "b", "c")val (last) = getFullName() println("$last")

Answer should be “c” but course suggest that it is “a”
Please clarify.

Please run the code again. The answer is ‘a’.
The last itself doesn’t mean that you’ll get the last value. In order to get c in $last, the order must be: val( _ , _ , last).