mirror of
https://github.com/KaiserY/trpl-zh-cn
synced 2025-02-22 20:22:18 +08:00
commit
9c3ca2e1c1
@ -246,7 +246,7 @@ let a: [i32; 5] = [1, 2, 3, 4, 5];
|
||||
|
||||
这里,`i32` 是每个元素的类型。分号之后,数字 `5` 表明该数组包含五个元素。
|
||||
|
||||
你还可以通过在放括号中指定初始值加分号再加元素个数的方式来创建一个每个元素都为相同值的数组:
|
||||
你还可以通过在方括号中指定初始值加分号再加元素个数的方式来创建一个每个元素都为相同值的数组:
|
||||
|
||||
```rust
|
||||
let a = [3; 5];
|
||||
@ -324,4 +324,4 @@ ch02-00-guessing-game-tutorial.html#comparing-the-guess-to-the-secret-number
|
||||
[vectors]: ch08-01-vectors.html
|
||||
[unrecoverable-errors-with-panic]: ch09-01-unrecoverable-errors-with-panic.html
|
||||
[wrapping]: https://doc.rust-lang.org/std/num/struct.Wrapping.html
|
||||
[appendix_b]: appendix-02-operators.md
|
||||
[appendix_b]: appendix-02-operators.md
|
||||
|
Loading…
Reference in New Issue
Block a user