Differences between revisions 1 and 4 (spanning 3 versions)
Revision 1 as of 2023-07-01 14:38:54
Size: 662
Comment:
Revision 4 as of 2026-01-18 23:10:48
Size: 0
Comment:
Deletions are marked like this. Additions are marked like this.
Line 1: Line 1:
= Julia Arrays =

Julia supports '''single-''' and '''multi-dimensional arrays'''.

<<TableOfContents>>

----



== Declaration ==

{{{
julia> [1,2,3]
3-element Vector{Int64}:
 1
 2
 3
}}}

Arrays take the common type of all their elements. If the elements are not of the same type but have a common [[Julia/DataTypes#Promotion|promotion type]], the elements are recast.

{{{
julia> [1, 2.3, 4//5]
3-element Vector{Float64}:
 1.0
 2.3
 0.8
}}}

Elements can also be explicitly recast at declaration of an array.

{{{
julia> Float32[1, 2.3, 4//5]
3-element Vector{Float32}:
 1.0
 2.3
 0.8
}}}



----
CategoryRicottone