Julia Program to demonstrate creation of Array using collect method

Program

# Julia program to demonstrate Array Creation using collect()
println("Printing numbers 1 to 5")
array1 = collect(1:5)
println(array1)
println("Printing numbers 11 to 20")
array2 = collect(11:20)
println(array2)

Output

$ julia demo-create-array-using-collect.jl
Printing numbers 1 to 5
[1, 2, 3, 4, 5]
Printing numbers 11 to 20
[11, 12, 13, 14, 15, 16, 17, 18, 19, 20]

Interactive Mode

``` julia> collect(1:5) 5-element Array{Int64,1}: 1 2 3 4 5 julia> collect(11:20) 10-element Array{Int64,1}: 11 12 13 14 15 16 17 18 19 20 ```