about summary refs log tree commit diff
path: root/src/doc
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2014-09-29 07:43:07 +0000
committerbors <bors@rust-lang.org>2014-09-29 07:43:07 +0000
commiteb816eee0f1803f03fbf046a26a1920659c14d82 (patch)
tree77a7754f7f6012a5ed3f9a3f26c8a019aa87e0ea /src/doc
parentb9478ee251d5fcb0ff003b5a4c62c50788b087f1 (diff)
parent1f4cd80ac57275342348c7c922b6594451495689 (diff)
auto merge of #17535 : Manishearth/rust/patch-2, r=steveklabnik
It's a rather useful syntax, and non-obvious.

A friend of mine is learning Rust and was trying to find a way to easily do such an initialization — he couldn't find it in the guide and was pretty surprised when I showed him. Looks like something that should be mentioned.

r? @steveklabnik 
Diffstat (limited to 'src/doc')
-rw-r--r--src/doc/guide.md1
1 files changed, 1 insertions, 0 deletions
diff --git a/src/doc/guide.md b/src/doc/guide.md
index 091437409c3..cab31fc5a9a 100644
--- a/src/doc/guide.md
+++ b/src/doc/guide.md
@@ -1507,6 +1507,7 @@ You can create an array with just square brackets:
 
 ```{rust}
 let nums = [1i, 2i, 3i];
+let nums = [1i, ..20]; // Shorthand for an array of 20 elements all initialized to 1
 ```
 
 So what's the difference? An array has a fixed size, so you can't add or