# Overwrite \`ARGS\` after reading

**URL:** <https://discourse.julialang.org/t/overwrite-args-after-reading/17511>\
**Category:** General Usage\
**Created:** [November 14, 2018, 12:31pm UTC](https://discourse.julialang.org/t/overwrite-args-after-reading/17511 "2018-11-14T12:31:43Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![carstenbauer](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/carstenbauer/32/4981_2.png) [@carstenbauer](https://discourse.julialang.org/u/carstenbauer)\
**Post date:** [November 14, 2018, 12:31pm UTC](https://discourse.julialang.org/t/overwrite-args-after-reading/17511/1 "2018-11-14T12:31:43Z")

</div>

```julia
julia> ARGS = 2
2

```

(fresh session)

```julia
julia> ARGS
0-element Array{String,1}

julia> ARGS = 2
ERROR: cannot assign variable Base.ARGS from module Main
Stacktrace:
 [1] top-level scope at none:0

```

Is it possible to set a global `ARGS = 2` after reading `ARGS` (i.e. `Base.ARGS`)?

(Probably not?)

---

<div class="post-metadata">

**Author:** ![carstenbauer](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/carstenbauer/32/4981_2.png) [@carstenbauer](https://discourse.julialang.org/u/carstenbauer)\
**Post date:** [November 14, 2018, 12:32pm UTC](https://discourse.julialang.org/t/overwrite-args-after-reading/17511/2 "2018-11-14T12:32:50Z")

</div>

Ok, I guess I can do

```julia
julia> Base.ARGS
0-element Array{String,1}

julia> ARGS = 2
2

```

Nevermind.

---

<div class="post-metadata">

**Author:** ![Tamas\_Papp](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tamas_papp/32/25949_2.png) [@Tamas\_Papp](https://discourse.julialang.org/u/Tamas_Papp)\
**Post date:** [November 14, 2018, 1:13pm UTC](https://discourse.julialang.org/t/overwrite-args-after-reading/17511/3 "2018-11-14T13:13:30Z")

</div>

Do you want to modify `Base.ARGS` or work with another variable that is incidentally named `ARGS` but is otherwise unrelated? If the first, you can do the usual vector manipulations, eg

```julia
push!(Base.ARGS, "--runfaster=please")

```

---

<div class="post-metadata">

**Author:** ![carstenbauer](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/carstenbauer/32/4981_2.png) [@carstenbauer](https://discourse.julialang.org/u/carstenbauer)\
**Post date:** [November 14, 2018, 1:40pm UTC](https://discourse.julialang.org/t/overwrite-args-after-reading/17511/4 "2018-11-14T13:40:00Z")

</div>

The latter, but thanks anyway!

---

<div class="post-metadata">

**Author:** ![stevengj](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/stevengj/32/71_2.png) [@stevengj](https://discourse.julialang.org/u/stevengj)\
**Post date:** [November 14, 2018, 2:30pm UTC](https://discourse.julialang.org/t/overwrite-args-after-reading/17511/5 "2018-11-14T14:30:07Z")

</div>

> [@carstenbauer](#):
>
> The latter, but thanks anyway!

Defining your own _local_ variable or _module global_ variable named `ARGS` is not a problem. The only problem arises in the REPL or similar contexts where `Base.ARGS` has already been imported and bound to a local variable `ARGS`.

For example:

```julia
julia> module Foo
       const ARGS = 2
       end
Main.Foo

julia> Foo.ARGS
2

```

or

```julia
julia> let ARGS = 3
           println("ARGS = $ARGS")
       end
ARGS = 3

```

or

```julia
julia> function foo()
           ARGS = 4
           return ARGS
       end
foo (generic function with 1 method)

julia> foo()
4

```
