diff options
| author | Alex Crichton <alex@alexcrichton.com> | 2015-02-10 08:41:38 -0800 |
|---|---|---|
| committer | Alex Crichton <alex@alexcrichton.com> | 2015-02-10 08:41:38 -0800 |
| commit | 7fcc330ea3a5cbe9b861edf05b74d332b53a64b0 (patch) | |
| tree | 73a7428b35a449815d76b98f3cb09d25aeba2ad5 | |
| parent | c62906d19c8054e52030144b89a8a1bf727b48dd (diff) | |
| parent | d3c787a94f2b66f337334e71634b1c80a359f0bd (diff) | |
| download | rust-7fcc330ea3a5cbe9b861edf05b74d332b53a64b0.tar.gz rust-7fcc330ea3a5cbe9b861edf05b74d332b53a64b0.zip | |
rollup merge of #22007: thiagooak/master
From #21829 clarify equivalency of tuples
| -rw-r--r-- | src/doc/trpl/compound-data-types.md | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/doc/trpl/compound-data-types.md b/src/doc/trpl/compound-data-types.md index 8b99278acb1..51a4edbdac8 100644 --- a/src/doc/trpl/compound-data-types.md +++ b/src/doc/trpl/compound-data-types.md @@ -72,6 +72,20 @@ if x == y { This will print `no`, because some of the values aren't equal. +Note that the order of the values is considered when checking for equality, +so the following example will also print `no`. + +```rust +let x = (1, 2, 3); +let y = (2, 1, 3); + +if x == y { + println!("yes"); +} else { + println!("no"); +} +``` + One other use of tuples is to return multiple values from a function: ```rust |
