# ERROR: TypeError: non-boolean (Int64) used in boolean context

**URL:** <https://discourse.julialang.org/t/error-typeerror-non-boolean-int64-used-in-boolean-context/38340>\
**Category:** General Usage\
**Tags:** question\
**Created:** [April 27, 2020, 10:22pm UTC](https://discourse.julialang.org/t/error-typeerror-non-boolean-int64-used-in-boolean-context/38340 "2020-04-27T22:22:09Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jing\_Zhang](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jing_zhang/32/13737_2.png) [@Jing\_Zhang](https://discourse.julialang.org/u/Jing_Zhang)\
**Post date:** [April 27, 2020, 10:22pm UTC](https://discourse.julialang.org/t/error-typeerror-non-boolean-int64-used-in-boolean-context/38340/1 "2020-04-27T22:22:09Z")

</div>

Dear Julia users,

My codes work in Julia 0.7.0, but when I tried to run them in Julia 1.0.5, I got the following error. It seems this error happens for multiple common Julia functions such as “findall” and etc… Any suggestions?

**ERROR: TypeError: non-boolean (Int64) used in boolean context**

Stacktrace:  
[1] iterate at ./iterators.jl:434 [inlined]  
[2] iterate at ./generator.jl:44 [inlined]  
[3] grow\_to!(::Array{Int64,1}, ::Base.Generator{Base.Iterators.Filter{typeof(last),Base.Iterators.Pairs{Int64,Int64,LinearIndices{1,Tuple{Base.OneTo{Int64}}},Array{Int64,1}}},typeof(first)}) at ./array.jl:674  
[4] collect at ./array.jl:617 [inlined]  
[5] findall(::Array{Int64,1}) at ./array.jl:2008

---

<div class="post-metadata">

**Author:** ![DNF](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/dnf/32/10191_2.png) [@DNF](https://discourse.julialang.org/u/DNF)\
**Post date:** [April 27, 2020, 10:28pm UTC](https://discourse.julialang.org/t/error-typeerror-non-boolean-int64-used-in-boolean-context/38340/2 "2020-04-27T22:28:42Z")

</div>

If it errors in v1, then you should get a warning in v0.7. Do you not see any?

Without seeing your code, I have to guess a bit, but it looks like you are calling `findall` on a vector of `Int64`, and that won’t work. What are you trying to locate in that vector? If it’s non- zero values, then you can try

```julia
findall(!iszero, X) 

```

---

<div class="post-metadata">

**Author:** ![Jing\_Zhang](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jing_zhang/32/13737_2.png) [@Jing\_Zhang](https://discourse.julialang.org/u/Jing_Zhang)\
**Post date:** [April 27, 2020, 10:41pm UTC](https://discourse.julialang.org/t/error-typeerror-non-boolean-int64-used-in-boolean-context/38340/3 "2020-04-27T22:41:35Z")

</div>

Thanks a lot! I did see three types of warnings in V0.7, as listed below

**┌ Warning:** Deprecated syntax `implicit assignment to global variable `ind\_run``.

**│** Use `global ind_run` instead.

**└** @ none:0

**┌ Warning:** Loop variable `ind_run` overwrites a variable in an enclosing scope. In the future the variable will be local to the loop instead.

**└** @ none:0

**┌ Warning:** In the future `findall(A)` will only work on boolean collections. Use `findall(x->x!=0, A)` instead.

**│** caller = ip:0x0

**└** @ Core :-1

---

<div class="post-metadata">

**Author:** ![pdeffebach](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/pdeffebach/32/10320_2.png) [@pdeffebach](https://discourse.julialang.org/u/pdeffebach)\
**Post date:** [April 27, 2020, 10:47pm UTC](https://discourse.julialang.org/t/error-typeerror-non-boolean-int64-used-in-boolean-context/38340/4 "2020-04-27T22:47:51Z")

</div>

I think it’s the third warning that’s causing the error. You should implement it’s suggestion and see if that works.

---

<div class="post-metadata">

**Author:** ![DNF](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/dnf/32/10191_2.png) [@DNF](https://discourse.julialang.org/u/DNF)\
**Post date:** [April 27, 2020, 10:49pm UTC](https://discourse.julialang.org/t/error-typeerror-non-boolean-int64-used-in-boolean-context/38340/5 "2020-04-27T22:49:11Z")

</div>

Yes, those will be errors in v1.0.

The last warning and suggestion is the same as the solution I suggested.
