From b6e643d51427dc609bcdfc5de3099f0ec6ef8118 Mon Sep 17 00:00:00 2001 From: steveklabnik Date: Fri, 1 Jun 2018 07:24:59 -0400 Subject: [PATCH] Clarify that tuples have a fixed length. Fixes #1380 --- 2018-edition/src/ch03-02-data-types.md | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/2018-edition/src/ch03-02-data-types.md b/2018-edition/src/ch03-02-data-types.md index 9230c4977..86359ea80 100644 --- a/2018-edition/src/ch03-02-data-types.md +++ b/2018-edition/src/ch03-02-data-types.md @@ -205,8 +205,9 @@ primitive compound types: tuples and arrays. #### The Tuple Type -A tuple is a general way of grouping together some number of other values with -a variety of types into one compound type. +A tuple is a general way of grouping together some number of other values +with a variety of types into one compound type. Tuples have a fixed length: +once declared, they cannot grow or shrink in size. We create a tuple by writing a comma-separated list of values inside parentheses. Each position in the tuple has a type, and the types of the @@ -270,7 +271,7 @@ index in a tuple is 0. Another way to have a collection of multiple values is with an *array*. Unlike a tuple, every element of an array must have the same type. Arrays in Rust are different from arrays in some other languages because arrays in Rust have a -fixed length: once declared, they cannot grow or shrink in size. +fixed length, like tuples. In Rust, the values going into an array are written as a comma-separated list inside square brackets: