Creating a copy of elements from a collection to an array in Julia – copyto!() Method Last Updated : 01 Apr, 2020 Improve Improve Like Article Like Save Share Report The copyto!() is an inbuilt function in julia which is used to copy all elements from the specified collection src to array dest. Syntax: copyto!(dest::AbstractArray, src) Parameters: dest::AbstractArray: Specified destination array. src: Specified source collection. Returns: It returns the copied elements from the specified collection src to array dest. Example 1: # Julia program to illustrate # the use of copyto !() method # Getting copied elements from the # specified collection src to array dest a = [1, 2, 3, 4, 5]; b = zeros(8); copyto !(b, a); println(b) Output: Example 2: # Julia program to illustrate # the use of copyto !() method # Getting copied elements from the # specified collection src to array dest a = [1., 2., 3., 4., 5.]; b = ones(8); copyto !(b, a); println(b) Output: Like Article Suggest improvement Previous Merging Dictionary collections in Julia - merge() and merge!() Methods Next Accessing element at a specific index in Julia - getindex() Method Share your thoughts in the comments Add Your Comment Please Login to comment...