2 ms·
and why can't we write it like you just did, with outer to inner dimensions going from left to right, i.e. in the same order the indices go when we actually use
by petschge 7y ago
and why can't we write it like you just did, with outer to inner dimensions going from left to right, i.e. in the same order the indices go when we actually use elements?
- pitaj 7y agoArray filling shares syntax with array typing and array declaration: [0; 10] // ten-element array filled with zeros [0, 0, 0, 0, 0, 0, 0, 0, 0, 0] // equivalent array with ten zeroes typed out [i32; 10] // type of ten-element i32 array Because the "filling" syntax is optional, it makes sense to place it after the fill value. The array typing syntax follows. Essentially you specify the value and say "copy this X times" (it only works with types that implement Copy IIRC) https://play.rust-lang.org/?version=stable&mode=debug&edition=2018&gist=128743f4da38f5c3099795ef27dc95e0 https://play.rust-lang.org/?version=stable&mode=debug&editio...