# Understanding some "logical" concept in Julia

**URL:** <https://discourse.julialang.org/t/understanding-some-logical-concept-in-julia/1925>\
**Category:** New to Julia\
**Created:** [February 5, 2017, 7:05pm UTC](https://discourse.julialang.org/t/understanding-some-logical-concept-in-julia/1925 "2017-02-05T19:05:54Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Daniel\_Art](https://avatars.discourse-cdn.com/v4/letter/d/ba8739/32.png) [@Daniel\_Art](https://discourse.julialang.org/u/Daniel_Art)\
**Post date:** [February 5, 2017, 7:05pm UTC](https://discourse.julialang.org/t/understanding-some-logical-concept-in-julia/1925/1 "2017-02-05T19:05:54Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![ihnorton](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ihnorton/32/26_2.png) [@ihnorton](https://discourse.julialang.org/u/ihnorton)\
**Post date:** [February 5, 2017, 7:16pm UTC](https://discourse.julialang.org/t/understanding-some-logical-concept-in-julia/1925/2 "2017-02-05T19:16:23Z")

</div>

Consider:

```julia
julia> bits(0x3)
"00000011"

julia> bits(0x05)
"00000101"

julia> bits(0x08)
"00001000"

```

Then read about [bitwise operations](https://en.wikipedia.org/wiki/Bitwise_operation) (`AND`, in this case).

Which will hopefully explain why:

```julia
julia> 3 & 5
1

julia> 8 & 5
0

```

---

<div class="post-metadata">

**Author:** ![Daniel\_Art](https://avatars.discourse-cdn.com/v4/letter/d/ba8739/32.png) [@Daniel\_Art](https://discourse.julialang.org/u/Daniel_Art)\
**Post date:** [February 5, 2017, 7:44pm UTC](https://discourse.julialang.org/t/understanding-some-logical-concept-in-julia/1925/3 "2017-02-05T19:44:44Z")

</div>

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