Skip to content

Commit

Permalink
feat: add the .. syntax
Browse files Browse the repository at this point in the history
  • Loading branch information
novusnota committed Oct 24, 2024
1 parent 09ee8e1 commit ea429a1
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions docs/src/content/docs/book/statements.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,20 @@ fun discard(s: Two) {
}
```

To completely ignore the rest of the fields, use `..` at the end of the list:

```tact
struct Many { one: Int; two: Int; three: Int; fans: Int }
fun ignore(s: Many) {
let Many { fans, .. } = s;
// --
// ↑
// ignores all the unspecified fields,
// defining only "fans"
}
```

:::caution

At the moment, destructuring of nested [Structs][s] or [Messages][m] isn't allowed. That is, the following won't work:
Expand Down

0 comments on commit ea429a1

Please sign in to comment.