# @. Operator

**URL:** <https://discourse.julialang.org/t/operator/35622>\
**Category:** General Usage\
**Created:** [March 6, 2020, 3:17am UTC](https://discourse.julialang.org/t/operator/35622 "2020-03-06T03:17:17Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![erlebach](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/erlebach/32/12973_2.png) [@erlebach](https://discourse.julialang.org/u/erlebach)\
**Post date:** [March 6, 2020, 3:17am UTC](https://discourse.julialang.org/t/operator/35622/1 "2020-03-06T03:17:17Z")

</div>

Hi,

Consider the following code:

```julia
a = 10
b = 1:10  

```

Obviously,

```julia
c = a .= b

```

works just fine. But I have more complex expressions and do not wish to spend my time adding dots everywhere. So I tried:

```julia
@. D = a + b

```

However, this produces the error that D is not defined. Why is that? I would expect D to be a vector.

ERROR: UndefVarError: D not defined  
Stacktrace:  
[1] top-level scope at none:0

---

<div class="post-metadata">

**Author:** ![klaff](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/klaff/32/7637_2.png) [@klaff](https://discourse.julialang.org/u/klaff)\
**Post date:** [March 6, 2020, 3:35am UTC](https://discourse.julialang.org/t/operator/35622/2 "2020-03-06T03:35:08Z")

</div>

`c = a .= b` doesn’t work, but I suspect you meant `c = a .+ b`, which does.

However, `@. D = a + b` is the same as `D .= a .+ b` which tries to do an in-place assignment to D.

If you first do `D = zeros(10)`, then `@. D = a + b` will work.

---

<div class="post-metadata">

**Author:** ![Mason](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mason/32/2423_2.png) [@Mason](https://discourse.julialang.org/u/Mason)\
**Post date:** [March 6, 2020, 3:37am UTC](https://discourse.julialang.org/t/operator/35622/3 "2020-03-06T03:37:40Z")

</div>

The syntax that would do what you expect is

```julia
D = @. a + b

```

which creates an array `D` instead of trying to do in-place assignment to an existing array.
