# ERROR: syntax: "\\" is not a unary operator

**URL:** <https://discourse.julialang.org/t/error-syntax-is-not-a-unary-operator/55854>\
**Category:** New to Julia\
**Tags:** question, windows, error, error-message\
**Created:** [February 23, 2021, 2:22pm UTC](https://discourse.julialang.org/t/error-syntax-is-not-a-unary-operator/55854 "2021-02-23T14:22:24Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![AngusRussell](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/angusrussell/32/22226_2.png) [@AngusRussell](https://discourse.julialang.org/u/AngusRussell)\
**Post date:** [February 23, 2021, 2:22pm UTC](https://discourse.julialang.org/t/error-syntax-is-not-a-unary-operator/55854/1 "2021-02-23T14:22:24Z")

</div>

I am currently working through the Introduction to Julia course and I am having trouble using the 😺 syntax. When I try to assign a value to it in Jupyter lab and the repl I get the following error message:

ERROR: syntax: “\” is not a unary operator

When I try to use it in nteract I get:

syntax: “\” is not a unary operator

Stacktrace:  
[1] top-level scope at In[3]:3  
[2] include\_string(::Function, ::Module, ::String, ::String) at .\loading.jl:1091

I am on windows using JuliaPro 1.5.3-1 installation. Probably unrelated but I also get an error using tab auto fill on Jupyter Lab.

---

<div class="post-metadata">

**Author:** ![rdeits](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/rdeits/32/286_2.png) [@rdeits](https://discourse.julialang.org/u/rdeits)\
**Post date:** [February 23, 2021, 2:38pm UTC](https://discourse.julialang.org/t/error-syntax-is-not-a-unary-operator/55854/2 "2021-02-23T14:38:22Z")

</div>

Can you post the actual code that generates the error? Otherwise it’s not obvious how you’re using `\` and generating this error. BTW, you can use ````` to make your code format nicely: [PSA: how to quote code with backticks](https://discourse.julialang.org/t/psa-how-to-quote-code-with-backticks/7530)

---

<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:** [February 23, 2021, 2:42pm UTC](https://discourse.julialang.org/t/error-syntax-is-not-a-unary-operator/55854/3 "2021-02-23T14:42:58Z")

</div>

The key to getting the emoji/latex unicode symbols is tab completion. You type `\:smile_cat:` and then hit TAB. It’s not a Julia syntax — it’s an editor/repl tab completion feature.

---

<div class="post-metadata">

**Author:** ![AngusRussell](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/angusrussell/32/22226_2.png) [@AngusRussell](https://discourse.julialang.org/u/AngusRussell)\
**Post date:** [February 23, 2021, 2:49pm UTC](https://discourse.julialang.org/t/error-syntax-is-not-a-unary-operator/55854/4 "2021-02-23T14:49:29Z")

</div>

Yeah, no problem. Quite new to this so hopefully I have followed the formatting correctly 🙂  
So in nteract:

```julia
\:smiley_cat: = 5
​
syntax: "\" is not a unary operator

Stacktrace:
 [1] top-level scope at In[1]:1
 [2] include_string(::Function, ::Module, ::String, ::String) at .\loading.jl:1091

```

I have tried to fix the issue by doing a fresh install and updating all the packages but still seem to get his error.

---

<div class="post-metadata">

**Author:** ![AngusRussell](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/angusrussell/32/22226_2.png) [@AngusRussell](https://discourse.julialang.org/u/AngusRussell)\
**Post date:** [February 23, 2021, 2:55pm UTC](https://discourse.julialang.org/t/error-syntax-is-not-a-unary-operator/55854/5 "2021-02-23T14:55:32Z")

</div>

So when I try using tab I get this error on Jupyter Lab:

```julia
syntax: "\" is not a unary operator

Stacktrace:
 [1] top-level scope at In[2]:2
 [2] include_string(::Function, ::Module, ::String, ::String) at .\loading.jl:1091
KERNEL EXCEPTION
BoundsError: attempt to access String
  at index [1:22]

Stacktrace:
 [1] checkbounds at .\strings\basic.jl:214 [inlined]
 [2] getindex(::String, ::UnitRange{Int64}) at .\strings\string.jl:248
 [3] complete_request(::ZMQ.Socket, ::IJulia.Msg) at C:\Users\angus\.julia\packages\IJulia\IDNmS\src\handlers.jl:115
 [4] #invokelatest#1 at .\essentials.jl:710 [inlined]
 [5] invokelatest at .\essentials.jl:709 [inlined]
 [6] eventloop(::ZMQ.Socket) at C:\Users\angus\.julia\packages\IJulia\IDNmS\src\eventloop.jl:8
 [7] (::IJulia.var"#15#18")() at .\task.jl:356

```

However I think this maybe an issue with Jupyter Lab specifically as it did work on Jupyter Notebook but I still got the syntax error.  
Pressing tab on nteract does nothing and on the repl it gives me suggestions but I still get the error:

```julia
syntax: "\" is not a unary operator

```

I have tried updating IJulia specifically to try to fix it but doesn’t seem to have an effect.

---

<div class="post-metadata">

**Author:** ![rdeits](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/rdeits/32/286_2.png) [@rdeits](https://discourse.julialang.org/u/rdeits)\
**Post date:** [February 23, 2021, 3:06pm UTC](https://discourse.julialang.org/t/error-syntax-is-not-a-unary-operator/55854/6 "2021-02-23T15:06:42Z")

</div>

Let’s focus on the REPL for now. Here’s what happens for me:

I type `\:smiley_cat:` and I see:

```julia
julia> \:smiley_cat:

```

I then press Tab and I see:

```julia
julia> 😺

```

as expected. What happens for you?

---

<div class="post-metadata">

**Author:** ![AngusRussell](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/angusrussell/32/22226_2.png) [@AngusRussell](https://discourse.julialang.org/u/AngusRussell)\
**Post date:** [February 23, 2021, 3:10pm UTC](https://discourse.julialang.org/t/error-syntax-is-not-a-unary-operator/55854/7 "2021-02-23T15:10:45Z")

</div>

Ah okay, that is working for me. I didn’t realise I had to type it all out explicitly and then press tab for the REPL. Thank you

---

<div class="post-metadata">

**Author:** ![rdeits](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/rdeits/32/286_2.png) [@rdeits](https://discourse.julialang.org/u/rdeits)\
**Post date:** [February 23, 2021, 3:23pm UTC](https://discourse.julialang.org/t/error-syntax-is-not-a-unary-operator/55854/8 "2021-02-23T15:23:33Z")

</div>

Right–you can still use Tab to complete a partially-typed entry like this, but you _still_ have to press Tab again to actually convert it into the desired Unicode character. Glad it’s working for you now!

---

<div class="post-metadata">

**Author:** ![orco](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/orco/32/7392_2.png) [@orco](https://discourse.julialang.org/u/orco)\
**Post date:** [December 14, 2021, 2:47pm UTC](https://discourse.julialang.org/t/error-syntax-is-not-a-unary-operator/55854/9 "2021-12-14T14:47:45Z")

</div>

the day I learnt something new about Julia and the double tab 🙃
