Word of advice: never ever use @eval in calculations. If you think that it is impossible to make calculations without @eval it means that your mental model of how Julia works is wrong. There are very good tutorials and docs online, which can give a proper understanding of good Julia code.
In particular, @eval evaluates in global scope, while i is local to your for loop, an MWE would be:
julia> for i = 1:10
var_name = Symbol("list", i)
@eval $var_name = rand(10)[i]
end
ERROR: UndefVarError: i not defined
that said I don’t see why you’re using @eval here at all, as Skoffer says it’s not needed in 99.9% of “regular” Julia usage, and in your case you just seem to index some array (?) by i and then write out the parts you selected by indexing into a csv file, which should be entirely doable without any invocation of @eval?
Could you explain what are you trying to do with eval? It seems that you are trying to generate a variable name programatically but in your example this is not necessary and probably in your program it also isn’t. Are you trying to port a code from maltab?
Why not something like this?
julia> for i=1:length(przedzaly)-1
file_name= "lista_polaczona_" * string(litery[i])
println(file_name)
current_lista = lista[przedzaly[i]+1:przedzaly[i+1],:]
writedlm("listy_wysylkowe/$(file_name).csv",current_lista)
end
This uses just a generic variable name “current_lista” in the local scope, whereas the @eval method would create length(przedzaly)-1 global variables with different names.