Destructuring
Patterns are used in bindings, parameters, and match arms.
Record destructuring
{ name, active } = userYou can also match nested structure:
{ tag: 'member', name } = valueArray destructuring
[first, second] = itemsWhy patterns matter
Patterns make FScript’s expression-oriented style more concise:
- bindings can unpack the shape you need immediately
matcharms can describe both branching and extraction- tagged unions become especially readable
Comparison to JavaScript
The syntax is familiar if you know JS destructuring, but in FScript patterns are also a central part of matching and type narrowing rather than just a convenience for assignment.