Skip to content

Commit f70b5e4

Browse files
Update env.jl to add example usage for the ENV functionality (#47384)
1 parent 734130a commit f70b5e4

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

base/env.jl

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,28 @@ variables.
7373
all keys to uppercase for display, iteration, and copying. Portable code should not rely on the
7474
ability to distinguish variables by case, and should beware that setting an ostensibly lowercase
7575
variable may result in an uppercase `ENV` key.)
76+
77+
If you want to create your own `ENV` variable, you can do so by specifying its name in quotation marks as
78+
is shown below:
79+
80+
# Examples
81+
```jldoctest ENV
82+
julia> ENV["JULIA_EDITOR"] = "vim"
83+
"vim"
84+
85+
julia> ENV["JULIA_EDITOR"]
86+
"vim"
87+
```
88+
89+
To see all of your active `ENV` variables in your current environment, you can simply do the following:
90+
```julia
91+
julia> ENV
92+
Base.EnvDict with "N" entries:
93+
"SECURITYSESSIONID" => "123"
94+
"USER" => "username"
95+
"MallocNanoZone" => "0"
96+
⋮ => ⋮
97+
```
7698
"""
7799
const ENV = EnvDict()
78100

0 commit comments

Comments
 (0)