Infinite array

An array that can truly hold infinitely many things is impossible on a computer with finite memory/storage.

Is what you need a way to dynamically increase the size of an array? Then you could have a look at the functions push!, resize!, and append! for example. It is fairly common that the final size of an array is not known at the time of creation, so what you could do is something like

data = [] # If you know the type of the elements, it's usually better to specify it here

userInput = ...

append!(data, userInput)

Julia automatically takes care that the array data is large enough to hold everything you want to put into it. But it is not “infinite” since you will run out of memory at some point and get an error, e.g. here I’m trying to ask for more space than my machine actually has:

julia> data = Array{Int, 1}(undef, 1000000000000000000)
ERROR: OutOfMemoryError()
Stacktrace:
 [1] Vector{Int64}(::UndefInitializer, m::Int64)
   @ Core ./boot.jl:477
 [2] top-level scope
   @ REPL[9]:1

I’m sure there are better ways than this, but maybe you could specify what you need exactly a bit more in detail.