From d3c787a94f2b66f337334e71634b1c80a359f0bd Mon Sep 17 00:00:00 2001 From: Thiago Carvalho Date: Fri, 6 Feb 2015 15:36:31 +0100 Subject: [PATCH] Book Compound Data Types update From Issue 21829 clarify equivalency of tuples --- src/doc/trpl/compound-data-types.md | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/doc/trpl/compound-data-types.md b/src/doc/trpl/compound-data-types.md index 901b44661b04c..aaa016f5a2519 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