Skip to content

Commit 31471ff

Browse files
committedNov 30, 2017
Clarified the multidimensional array access
1 parent e09600d commit 31471ff

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed
 

‎src/expressions/array-expr.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -54,16 +54,16 @@ _panicked state_ if it fails.
5454
```rust,should_panic
5555
([1, 2, 3, 4])[2]; // Evaluates to 3
5656
57+
let b = [[1, 0, 0], [0, 1, 0], [0, 0, 1]];
58+
b[1][2]; // multidimensional array indexing
59+
5760
let x = (["a", "b"])[10]; // warning: const index-expr is out of bounds
5861
5962
let n = 10;
6063
let y = (["a", "b"])[n]; // panics
6164
6265
let arr = ["a", "b"];
6366
arr[10]; // panics
64-
65-
# let b = [[1, 0, 0], [0, 1, 0], [0, 0, 1]];
66-
b[1][2]; // multidimensional array indexing
6767
```
6868

6969
The array index expression can be implemented for types other than arrays and slices

0 commit comments

Comments
 (0)