Printing an array into a text file

Welcome!

First, check out how to quote your code with backticks to maintain readability.

The issue is that your iterator for i in notes means that each i is the element of notes. So what you want is

for i in notes # or for note in notes
println(f, i)
end

Or if you want to iterate through the indices of notes, you can use the function eachindex

for i in eachindex(notes)
println(f, notes[i])
end
2 Likes