Quote: "My first attemp to store it in a local array did not help, since I don't know how to declare local arrays (is it possible in darkbasic?)."
Apparently, have a look at this:
local dim Myarray(5) as integer
for n = 1 to 5
MyArray(n) = (n + 1)^2
text 0, n*30, "MyArray (first declaration): " + str$(MyArray(n))
next n
local_array()
wait key
end
function local_array()
local dim Myarray(5) as integer
for n = 1 to 5
Myarray(n) = n - (n)^2
text 0, n*30 + 200, "MyArray (function declaration): " + str$(MyArray(n))
next n
endfunction
Arrays are automatically global by default. So have another try with local arrays using the local command.