Skip to content

Commit 7fcc330

Browse files
committed
rollup merge of rust-lang#22007: thiagooak/master
From rust-lang#21829 clarify equivalency of tuples
2 parents c62906d + d3c787a commit 7fcc330

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

src/doc/trpl/compound-data-types.md

+14
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,20 @@ if x == y {
7272

7373
This will print `no`, because some of the values aren't equal.
7474

75+
Note that the order of the values is considered when checking for equality,
76+
so the following example will also print `no`.
77+
78+
```rust
79+
let x = (1, 2, 3);
80+
let y = (2, 1, 3);
81+
82+
if x == y {
83+
println!("yes");
84+
} else {
85+
println!("no");
86+
}
87+
```
88+
7589
One other use of tuples is to return multiple values from a function:
7690

7791
```rust

0 commit comments

Comments
 (0)