Why is this ternary operator not returning an error?

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.

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

1 Like

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