Sorry this takes so much verbiage. I know that most of the functions I need to write will have several variables already defined prior to the definition of the function. The value of these variables must be accessible within the body of the function and must be able to be modified within the body of the function. The revised values must be returned by the function after which the returned values can be used to update the original values of those variables.

The concept that I thought was feasible was to pass the initial values of the variables as arguments of the function. And the revised values, created when the function is called, would be returned by the function as a tuple of whatever size is required. The values of the components of the returned tuple could then be used to update the original values of the variables.

So far I havenâ€™t been able to get this to work. I donâ€™t know whether this is because this simply isnâ€™t possible in Julia or because Iâ€™m just missing a couple crucial ingredients. Hereâ€™s the example that I havenâ€™t gotten to work:

# ftest1.jl a test program to see if a function can overcome scope problems.

arr = [â€śabcâ€ť,â€śdefâ€ť,â€śghiâ€ť,â€śjklâ€ť,â€śmnoâ€ť]

x = 15

y = 25

println(â€śPrior to function definition: arr=â€ť,arr," x=",x," y=",y)

function Example(arri,xi,yi)

xi = xi + yi

yi = xi * yi

arrt = arri

arri[1] = arrt[5], arri[2]=arrt[4], arri[4] =arrt[2], arri[5]=arrt[1]

println(â€śWithin function definition: arri=â€ť,arri," xi=",xi," yi=",yi)

return arri,xi,yi

end

(arr,x,y) = Example(arr,x,y)

println(â€śAfter completion of function call: arr=â€ť,arr," x=",x," y=",y)