Is tuple destructuring still supported?

Hi, we are testing some code using tuples and the compiler seems to do not like destructuring tuples. btw, the online contract tool does the same thing.

The following code:

contract Tuples = 
  
  public function f() : int =
    let zzz = (30, 30, 30)
    let (x,y,z) = zzz
    x

Yields an error at second let.
Thanks.

1 Like

You can deconstruct a tuple using switch, but not in a direct assignment:

function f() =
  let t = (1, 2)
  switch(t)
    (a, _) => a
4 Likes