This is the error
# announcements
a
This is the error
k
Please send you entire message at once, this is annoying as we get multiple notifications and we don't know where to start a thread.
2
But
Pair
is for two values, you probably want
Triple
instead.
a
Oh sorry
Is there something after triole
sorry triple
k
(you can edit messages too to fix typos 😉 )
1
a
Ok but code is showing error
error: type inference failed. Expected type mismatch: inferred type is Pair<Pair<String, String>, Int> but Triple<String, String, Int> was expected
return ("Hi" to "Bye" to 5)
k
And no, the standard library doesn't have anything for 4 values or higher, but data classes are pretty easy:
data class MyReturn(val x: String, val y: String, val z: Int, val w: Int)
Descructuring declarations work just the same way as they do on tuples. There's also the advantage that you can name the values now.
You can't use multiple `to`s, that creates a nested pair. Use the constructor
Triple("Hi", "Bye", 5)
instead.
a
Hey Please see the error
k
Yes I did see it, you're trying to use
to
but that's only for pairs.
a
what is for triples
k
Look at my second-last comment, now third.
a
Thanks