# Global variable declaration

**URL:** <https://discourse.julialang.org/t/global-variable-declaration/10347>\
**Category:** General Usage\
**Created:** [April 15, 2018, 2:03am UTC](https://discourse.julialang.org/t/global-variable-declaration/10347 "2018-04-15T02:03:27Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Qiyamah](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/qiyamah/32/2660_2.png) [@Qiyamah](https://discourse.julialang.org/u/Qiyamah)\
**Post date:** [April 15, 2018, 2:03am UTC](https://discourse.julialang.org/t/global-variable-declaration/10347/1 "2018-04-15T02:03:27Z")

</div>

Hi,  
I am having following problem, I don’t understand why though.  
Can anybody help

```nohighlight
julia> let
       global d1, d2=3, d3::Int, d4::AbstractString = "ddd"
       end
ERROR: syntax: invalid assignment location "3"

```

---

<div class="post-metadata">

**Author:** ![yurivish](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/yurivish/32/307_2.png) [@yurivish](https://discourse.julialang.org/u/yurivish)\
**Post date:** [April 15, 2018, 2:10am UTC](https://discourse.julialang.org/t/global-variable-declaration/10347/2 "2018-04-15T02:10:28Z")

</div>

The message is somewhat confusing and there’s an [open issue](https://github.com/JuliaLang/julia/issues/26021) about it. The syntax for multiple assignment is `a, b = 1, 2` rather than `a = 1, b = 2`.

In your case you can factor out the variables you want to assign to and use multiple assignment (`global d2, d4 = 3, "ddd"`), and declare the others separately without initial values as `global d1, d3`.

Note that at this time Julia doesn’t support type declarations on global variables, so the declarations for `d3` and `d4` would also not have succeeded here. I don’t think it’s a fundamental restriction, so it may be lifted in the future.
