# Abusing operators

**URL:** <https://discourse.julialang.org/t/abusing-operators/71018>\
**Category:** New to Julia\
**Created:** [November 5, 2021, 6:10pm UTC](https://discourse.julialang.org/t/abusing-operators/71018 "2021-11-05T18:10:46Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![dodoplus](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/dodoplus/32/30148_2.png) [@dodoplus](https://discourse.julialang.org/u/dodoplus)\
**Post date:** [November 5, 2021, 6:10pm UTC](https://discourse.julialang.org/t/abusing-operators/71018/1 "2021-11-05T18:10:46Z")

</div>

was surprised to find this is a valid Julia code:

```julia
julia> ==(==,==)
true

```

This fails, though:

```julia
julia> == == ==
ERROR: syntax: "==" is not a unary operator

```

I think both _should_ parse the same, not that anyone sane would write either expression (hmm…)

---

<div class="post-metadata">

**Author:** ![mbauman](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mbauman/32/31082_2.png) [@mbauman](https://discourse.julialang.org/u/mbauman)\
**Post date:** [November 5, 2021, 6:14pm UTC](https://discourse.julialang.org/t/abusing-operators/71018/2 "2021-11-05T18:14:21Z")

</div>

You just need parentheses:

```julia
julia> (==) == (==)
true

```

This isn’t really abuse — nearly all “operators” are functions themselves and can be called as such. They just have special parsing that can make it tricky for Julia to see the function call as a function call or the infix operator syntax as infix syntax, so parentheses are sometimes required to disambiguate.

---

<div class="post-metadata">

**Author:** ![jlapeyre](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jlapeyre/32/4514_2.png) [@jlapeyre](https://discourse.julialang.org/u/jlapeyre)\
**Post date:** [November 5, 2021, 7:10pm UTC](https://discourse.julialang.org/t/abusing-operators/71018/3 "2021-11-05T19:10:39Z")

</div>

Or even

```julia
julia> (==) == ==
true

```

just to prevent the first `==` from being tried as a unary operator.
