# Unexpected behavior when assigning value to variable compared to using the value itself

**URL:** <https://discourse.julialang.org/t/unexpected-behavior-when-assigning-value-to-variable-compared-to-using-the-value-itself/104414>\
**Category:** New to Julia\
**Tags:** question\
**Created:** [September 29, 2023, 10:22pm UTC](https://discourse.julialang.org/t/unexpected-behavior-when-assigning-value-to-variable-compared-to-using-the-value-itself/104414 "2023-09-29T22:22:16Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Michael\_Hess](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/michael_hess/32/49754_2.png) [@Michael\_Hess](https://discourse.julialang.org/u/Michael_Hess)\
**Post date:** [September 29, 2023, 10:22pm UTC](https://discourse.julialang.org/t/unexpected-behavior-when-assigning-value-to-variable-compared-to-using-the-value-itself/104414/1 "2023-09-29T22:22:16Z")

</div>

Hello,

I am still pretty new to Julia, so I’m sure this is a silly question, but I am having a hard time searching for an explanation. I am seeing some strange behavior I was hoping someone could clarify for me.

Essentially the following code gives me the expected output - it broadcasts the 1 to an array and then does element-wise division for every item in the divisors:

```julia
divisors = 1:2
1 ./ divisors

```

with this output

```julia
2-element Vector{Float64}:
1.0 
0.5

```

If I instead do not assign the range to a variable and just do:

```julia
1 ./ 1:2

```

I get the following output:

```julia
1.0:1.0:2.0

```

I’m not even seeing how this could be a possible output for this input, so I am very confused what might be happening here. Could someone explain what difference is happening under the hood to lead to the altered responses?  
Thanks and sorry again if it’s a dumb question!!

---

<div class="post-metadata">

**Author:** ![mikmoore](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mikmoore/32/31109_2.png) [@mikmoore](https://discourse.julialang.org/u/mikmoore)\
**Post date:** [September 29, 2023, 10:26pm UTC](https://discourse.julialang.org/t/unexpected-behavior-when-assigning-value-to-variable-compared-to-using-the-value-itself/104414/2 "2023-09-29T22:26:32Z")

</div>

`:` has not-higher (specifically: lower) operator precedence than `/`, so it’s parsing `1 ./ 1:2` as `(1 ./ 1):2`, yielding `1.0:2`. Try `1 ./ (1:2)` instead.
