The idiomatic answer to this is let, I believe:
let z = 0
    global function incrementZ()
        z += 1
        return z
    end
end
println(incrementZ())
println(incrementZ())
The idiomatic answer to this is let, I believe:
let z = 0
    global function incrementZ()
        z += 1
        return z
    end
end
println(incrementZ())
println(incrementZ())