Syntax error when trying to use bitwise operators

I apologize if this is a stupid question, but I’m literally just starting to learn Julia, working my way through the manual.

When trying out the bitwise operations, say exclusive or, I found that I couldn’t actually type them in Julia (here, <TAB> indicates the tab key):

julia> 123 v\underbar<TAB> 234
ERROR: syntax: extra token "v̲" after end of expression
Stacktrace:
 [1] top-level scope
   @ none:1

julia> 123 \vee<TAB>\underbar<TAB> 234

ERROR: UndefVarError: ∨̲ not defined
Stacktrace:
 [1] top-level scope
   @ REPL[74]:1

julia>

Copying and pasting directly from the manual works, but the pasted character shows up as a box in my terminal, and in any case this doesn’t tell me how to input it.

As such, I have a question and a suggestion.

  1. The question: how DO I input the symbols for these operations?
  2. The suggestion: it would be cool if, when the manual uses symbols that aren’t on a standard keyboard but that can be input using TeX commands instead, it tells users what those TeX commands are.

Thanks!

If you type ? in the repl you’ll get a >help prompt, and you can paste unfamiliar characters into it like this

help?> ⊻
"⊻" can be typed by \xor<tab>
4 Likes

As for the box in the terminal, if you use VSCode in combination with the JuliaMono font, you shouldn’t run into any problems

2 Likes

Can you specify, please, in more detail the advantages of having the juliamono font available?
Once the new fonts are installed on windows, what must be done to use them in vscode?

You could also just write xor(123, 234).

Can you specify, please, in more detail the advantages of having the juliamono font available?

There are some unicode symbols that do not render well with the standard font, and that are taken care of by JuliaMono. Also it’s monospaced, so you have the guarantee that every letter and symbol has the exact same width. Of course it’s not a big deal but I kind of like the new look of my code.

Once the new fonts are installed on windows, what must be done to use them in vscode?

See the documentation here: JuliaMono font - FAQ

1 Like