about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorSteve Klabnik <steve@steveklabnik.com>2015-03-04 16:27:18 -0500
committerSteve Klabnik <steve@steveklabnik.com>2015-03-04 16:27:18 -0500
commit61a2766136536f9993ae095075ec766cfc729f8b (patch)
treed8e4bf0410e4de50d7a3a94f2b2830cdc9dbc416 /src
parent3b3bb0e682c2d252e9f62dd9df5cff9552af91ad (diff)
downloadrust-61a2766136536f9993ae095075ec766cfc729f8b.tar.gz
rust-61a2766136536f9993ae095075ec766cfc729f8b.zip
Note the alternate form of vec in trpl
Diffstat (limited to 'src')
-rw-r--r--src/doc/trpl/arrays-vectors-and-slices.md6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/doc/trpl/arrays-vectors-and-slices.md b/src/doc/trpl/arrays-vectors-and-slices.md
index d4e2ad5cd5f..f1b5ecf4ff0 100644
--- a/src/doc/trpl/arrays-vectors-and-slices.md
+++ b/src/doc/trpl/arrays-vectors-and-slices.md
@@ -60,6 +60,12 @@ let v = vec![1, 2, 3]; // v: Vec<i32>
 brackets `[]` with `vec!`. Rust allows you to use either in either situation,
 this is just convention.)
 
+There's an alternate form of `vec!` for repeating an initial value:
+
+```
+let v = vec![0; 10]; // ten zeroes
+```
+
 You can get the length of, iterate over, and subscript vectors just like
 arrays. In addition, (mutable) vectors can grow automatically: