# Broadcast into variables

**URL:** <https://discourse.julialang.org/t/broadcast-into-variables/61353>\
**Category:** General Usage\
**Tags:** question\
**Created:** [May 18, 2021, 11:26am UTC](https://discourse.julialang.org/t/broadcast-into-variables/61353 "2021-05-18T11:26:01Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![stakaz](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/stakaz/32/4740_2.png) [@stakaz](https://discourse.julialang.org/u/stakaz)\
**Post date:** [May 18, 2021, 11:26am UTC](https://discourse.julialang.org/t/broadcast-into-variables/61353/1 "2021-05-18T11:26:01Z")

</div>

Hello,

I am a little bit confused, is this supposed to work some how? When a function returns a tuple, can I somehow add each element of this tuple to a separate variable without temp allocations? Something like this:

```julia
f(x) = 2x, 3x

A = 1 
B = 2 

A, B .+= f(3)

```

I expect `A = 7` and `B = 11` afterwards.

Thanks

---

<div class="post-metadata">

**Author:** ![oheil](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/oheil/32/220745_2.png) [@oheil](https://discourse.julialang.org/u/oheil)\
**Post date:** [May 18, 2021, 12:20pm UTC](https://discourse.julialang.org/t/broadcast-into-variables/61353/2 "2021-05-18T12:20:13Z")

</div>

> [@stakaz](#):
>
> `A, B .+= f(3)`

This is  
`A,B .= (A,B) .+ f(3)`  
but the RHS already returns a Tuple, so `.=` is wrong. What you want is:  
`A,B = (A,B) .+ f(3)`

---

<div class="post-metadata">

**Author:** ![stakaz](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/stakaz/32/4740_2.png) [@stakaz](https://discourse.julialang.org/u/stakaz)\
**Post date:** [May 20, 2021, 10:40am UTC](https://discourse.julialang.org/t/broadcast-into-variables/61353/3 "2021-05-20T10:40:39Z")

</div>

Thanks, I have forgotten to answer to you. It does not look that concise but of course this syntax is consistent with what I want it to do 😉
