Modify global variable in a function

I want to rename a variable in a function for later use with its new value.

What I was thinking was this:

myVar = ""

function renameVar()
     myVar = "Hello"
end

renameVar()

println(myVar) #What I wanted is for it to show **Hello** here

https://docs.julialang.org/en/v1/manual/variables-and-scoping/#On-Soft-Scope

2 Likes