Initialize an array of arrays in Julia

If you want an array of arrays as opposed to a matrix (i.e. 2-dimensional Array):

a = Array[ [1,2], [3,4] ]

You can parameterize (specify the type of the elements) an Array literal by putting the type in front of the []. So here we are parameterizing the Array literal with the Array type. This changes the interpretation of brackets inside the literal declaration.

Leave a Comment

File not found.