Logo

Programming-Idioms

History of Idiom 26 > diff from v100 to v101

Edit summary for version 101 by programming-idioms.org:
[Rust] Added Doc URL

Version 100

2022-05-31, 14:21:54

Version 101

2022-08-29, 08:29:23

Idiom #26 Create a 2-dimensional array

Declare and initialize a matrix x having m rows and n columns, containing real numbers.

Idiom #26 Create a 2-dimensional array

Declare and initialize a matrix x having m rows and n columns, containing real numbers.

Variables
x,m,n
Variables
x,m,n
Extra Keywords
2d
Extra Keywords
2d
Code
let mut x = [[0.0; N] ; M];
Code
let mut x = [[0.0; N] ; M];
Comments bubble
This works only when M and N are constant.
Elements have type f64
Comments bubble
This works only when M and N are constant.
Elements have type f64
Doc URL
https://doc.rust-lang.org/std/primitive.array.html
Demo URL
https://play.rust-lang.org/?gist=a25a0b7137c8f5c8d0534614b5996830&version=stable&mode=debug
Demo URL
https://play.rust-lang.org/?gist=a25a0b7137c8f5c8d0534614b5996830&version=stable&mode=debug