julialangHow to append to an array in JuliaLang?
Appending to an array in JuliaLang is done using the push!
function. This function adds an element to the end of an array. For example:
julia> my_array = [1, 2, 3]
3-element Array{Int64,1}:
1
2
3
julia> push!(my_array, 4)
4-element Array{Int64,1}:
1
2
3
4
The push!
function takes two arguments: the array to which the element should be appended, and the element to be appended. In the example above, my_array
is the array to which the element 4
is appended.
Helpful links
More of Julialang
- How to get JuliaLang version?
- How to test code in JuliaLang?
- How to work with matrices in JuliaLang?
- How to use the println function in JuliaLang?
- How to install JuliaLang on Ubuntu?
- How to use the JuliaLang PackageCompiler?
- How to create a package in JuliaLang?
- How to use try catch in JuliaLang?
- How to use regular expressions in JuliaLang?
- How to use enums in JuliaLang?
See more codes...