Logo

Programming-Idioms

History of Idiom 26 > diff from v15 to v16

Edit summary for version 16 by :
[Go] +DemoURL

Version 15

2015-11-30, 12:37:27

Version 16

2015-12-30, 17:46:26

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.

Code
const m, n = 2, 3
var x [m][n]float64
Code
const m, n = 2, 3
var x [m][n]float64
Comments bubble
m, n must be constant for this syntax to be valid.
Here x is of type [2][3]float64, it is not a slice.
Comments bubble
m, n must be constant for this syntax to be valid.
Here x is of type [2][3]float64, it is not a slice.
Demo URL
http://play.golang.org/p/cAqJGf9q1y