Ashutosh Panda
12/08/2019, 1:47 PMkarelpeeters
12/08/2019, 1:47 PMPair
is for two values, you probably want Triple
instead.Ashutosh Panda
12/08/2019, 1:48 PMkarelpeeters
12/08/2019, 1:49 PMAshutosh Panda
12/08/2019, 1:49 PMerror: 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)
karelpeeters
12/08/2019, 1:50 PMdata 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.Triple("Hi", "Bye", 5)
instead.Ashutosh Panda
12/08/2019, 1:51 PMkarelpeeters
12/08/2019, 1:52 PMto
but that's only for pairs.Ashutosh Panda
12/08/2019, 1:52 PMkarelpeeters
12/08/2019, 1:53 PMAshutosh Panda
12/08/2019, 1:53 PM