Understanding some "logical" concept in Julia


#1

As a newbie in Julia, I’d like to understand the “logical” concept in Julia.

For instance, Can some one plz explain to me why

3 & 5 > 0 is true

while

8 & 5 > 0 is false

What is the order of reading these two logical script? is is right to left or left to right? Tnx


#2

Consider:

julia> bits(0x3)
"00000011"

julia> bits(0x05)
"00000101"

julia> bits(0x08)
"00001000"

Then read about bitwise operations (AND, in this case).

Which will hopefully explain why:

julia> 3 & 5
1

julia> 8 & 5
0

#3

@ihnorton , Thanks a lot! It makes it very clear for me :slight_smile: