Skip to content

Commit 4ac14d6

Browse files
authored
Update array.md
The example says that out-of-bound indexing causes a runtime error, but 1) doesn't specify array or slice, then 2) proceeds to demonstrate with an array, which is a _compile_ error. Add both cases and clarify the prose.
1 parent 31961fe commit 4ac14d6

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/primitives/array.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,9 @@ fn main() {
6363
}
6464
}
6565
66-
// Out of bound indexing causes compile time error.
66+
// Out of bound indexing on array causes compile time error.
6767
//println!("{}", xs[5]);
68+
// Out of bound indexing on slice causes runtime error.
69+
//println!("{}", xs[..][5]);
6870
}
6971
```

0 commit comments

Comments
 (0)