blob: b4cc810c2fdffbcfdd2c84db835fe4544c36d385 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
|
[[Rust]]
The array notation is a bit special compared to other languages so I will write it down here:
Unlike tuples, arrays can only hold one type:
`let a: [i32; 5] = [1, 2, 3, 4, 5]` Specifies an array of length 5.
`let a = [3; 5];` specifies an array of length 5 with all values set to 3.
> Note the semicolon rather than a comma!
Indexing as usual
Out of bounds access result in a panic.
|