# Why is this ternary operator not returning an error?

**URL:** <https://discourse.julialang.org/t/why-is-this-ternary-operator-not-returning-an-error/83924>\
**Category:** New to Julia\
**Tags:** question\
**Created:** [July 7, 2022, 11:41pm UTC](https://discourse.julialang.org/t/why-is-this-ternary-operator-not-returning-an-error/83924 "2022-07-07T23:41:41Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![phantom](https://avatars.discourse-cdn.com/v4/letter/p/e0b2c6/32.png) [@phantom](https://discourse.julialang.org/u/phantom)\
**Post date:** [July 7, 2022, 11:41pm UTC](https://discourse.julialang.org/t/why-is-this-ternary-operator-not-returning-an-error/83924/1 "2022-07-07T23:41:41Z")

</div>

Kind of a silly question but I have the following formula

`f(x,y)= x+y >0 ? x = y : 0`

Where I incorrectly typed `x==y` as `x=y`

However now when Input `f(5,7)` Julia just returns the `y` value, i.e. `7`

` julia> f(5,7) 7`

as opposed to evaluating `5=7` which I imagine would yield an error.

I suspect I am missing something very elementary and was just wondering if anyone could explain what was going on. Thanks.

---

<div class="post-metadata">

**Author:** ![jling](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jling/32/212909_2.png) [@jling](https://discourse.julialang.org/u/jling)\
**Post date:** [July 7, 2022, 11:50pm UTC](https://discourse.julialang.org/t/why-is-this-ternary-operator-not-returning-an-error/83924/2 "2022-07-07T23:50:21Z")

</div>

`x=y` re-binds `x` to value of y.

this “expression” itself have the value of the right-hand size, which is `y`’s value

---

<div class="post-metadata">

**Author:** ![phantom](https://avatars.discourse-cdn.com/v4/letter/p/e0b2c6/32.png) [@phantom](https://discourse.julialang.org/u/phantom)\
**Post date:** [July 7, 2022, 11:59pm UTC](https://discourse.julialang.org/t/why-is-this-ternary-operator-not-returning-an-error/83924/3 "2022-07-07T23:59:38Z")

</div>

oh awesome, thank you so much for clearing that up!
