```fun isZero(point: Pair<Int, Int>): Boolea...
# getting-started
u
Copy code
fun isZero(point: Pair<Int, Int>): Boolean {
  val [x, y] = point      // one way
  [val x, val y] = point  // or another
  return x == 0 && y == 0
}
The new positional destructuring syntax, will I be able to use it on my custom tuple types? (quadruple, etc)
y
I believe so. All you should need is
componentN
functions for whatever
N
you want
👍 1
s
componentN
functions are automatically added to
data classes
but you can manually add them to any class. Don't forget the
operator
keyword when writting your own
componentN
functions. see destructuring declarations
👍 1
l
I didn't know about the new positional syntax. I checked the documentation, and if I understand it correctly, square brackets always use positional index, while parentheses use names or positional, with priority given to names?