diego.brum
03/24/2021, 3:30 PMvar (x, y) = Tuple.Create("hello", "world");
// or
var (x, y) = ("hello", "again");
// or also
var x = ("hello", "again");
x.Item1 // hello
x.Item2 // again
// or also also
var x = (Xpto: "Hello", Yup: "Again")
x.Xpto
x.Yup
in Kotlin I had read about destructors and find the Pair class
Is it the equivalent? And is it possible initialise "Pair" on the fly like C#?Ruckus
03/24/2021, 3:37 PMto
to make a `Pair`: val (x, y) = "hello" to "again"
val x = "hello" to "again"
x.first
x.second
Triple
class, but Kotlin does not have tuples, so you cannot create arbitrary sizes or use custom keys.diego.brum
03/24/2021, 3:39 PMCasey Brooks
03/24/2021, 3:43 PMdiego.brum
03/24/2021, 3:47 PMRuckus
03/24/2021, 4:16 PMJordan Foo
03/24/2021, 4:40 PMtypealias MyPair = Pair<String, Int>
and
val myPair: MyPair = "myString" to 1
val (myString, myInt) = myPair