mirror of
https://github.com/rust-lang/rust.git
synced 2025-02-08 21:13:55 +00:00
Include definition of tuples for destructuring.
Updates the tutorial to include a simple definition for tuples in section 4.2. Fixes #5132.
This commit is contained in:
parent
44d4d6de76
commit
f0d0cbfff8
@ -495,7 +495,10 @@ omitted.
|
|||||||
|
|
||||||
A powerful application of pattern matching is *destructuring*:
|
A powerful application of pattern matching is *destructuring*:
|
||||||
matching in order to bind names to the contents of data
|
matching in order to bind names to the contents of data
|
||||||
types. Assuming that `(float, float)` is a tuple of two floats:
|
types.
|
||||||
|
|
||||||
|
> ***Note:*** The following code makes use of tuples (`(float, float)`) which
|
||||||
|
> are explained later. For now you can think of tuples as a list of items.
|
||||||
|
|
||||||
~~~~
|
~~~~
|
||||||
fn angle(vector: (float, float)) -> float {
|
fn angle(vector: (float, float)) -> float {
|
||||||
|
Loading…
Reference in New Issue
Block a user