Say I'm simulating an experiment and I don't know when the step will terminate. With the while condition and pushing to an array of Any, the function isn't type stable.
function simulate()
result = []
alive = true
while alive
push!(result,alive)
alive = rand(Bool)
end
return result
end
Is there a way to accomplish this in a type stable way?