You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* Add tuple deconstruction examples
Fixes#768
Adding examples for tuple deconstruction and deconstruction assignment.
* Update standard/expressions.md
Co-authored-by: Nigel-Ecma <[email protected]>
* Add example that can't be inferred
Add an additional example where the types can't be inferred.
* fix example templates.
---------
Co-authored-by: Nigel-Ecma <[email protected]>
@@ -1600,6 +1601,35 @@ A *tuple_expression* is classified as a tuple.
1600
1601
1601
1602
A *deconstruction_expression*`var (e1, ..., en)` is shorthand for the *tuple_expression*`(var e1, ..., var en)` and follows the same behavior. This applies recursively to any nested *deconstruction_tuple*s in the *deconstruction_expression*. Each identifier nested within a *deconstruction_expression* thus introduces a declaration expression ([§12.17](expressions.md#1217-declaration-expressions)). As a result, a *deconstruction_expression* can only occur on the left side of a simple assignment.
1602
1603
1604
+
> *Example*:
1605
+
> The following code declares three variables: a, b, and c. Each of which is an integer and is assigned its value from the tuple on the right hand side of the assignment.
0 commit comments