While making a code, I had the following condition to throw an error:
n<0 | !isa(n,Integer)
For n=3.0, the code was giving false. Though it took me a while, I now understand that “|” takes precedence. Even though, in the docs, it says that Julia (unlike Python, but like Java) throws an error when trying to use integers in a local context, but when I do
The point is that | in Julia is bitwise OR, and is treated like an arithmetic operator similar to + (hence having higher precedence than <).
Usually, for logical OR in Julia, people use ||, which has lower precedence than < and is probably what you want here.
(The caveat is that || is short-circuiting. Very occasionally, for performance-critical code in a tight loop, it is sometimes faster to use the non-short-circuiting |. But in this case you usually need explicit parentheses to make the precedence come out right.)