# Behavior of \`CartesianIndex\` for \`Bool\`

**URL:** <https://discourse.julialang.org/t/behavior-of-cartesianindex-for-bool/25532>\
**Category:** Internals & Design\
**Tags:** question\
**Created:** [June 21, 2019, 5:52pm UTC](https://discourse.julialang.org/t/behavior-of-cartesianindex-for-bool/25532 "2019-06-21T17:52:47Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![bkamins](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/bkamins/32/208538_2.png) [@bkamins](https://discourse.julialang.org/u/bkamins)\
**Post date:** [June 21, 2019, 5:52pm UTC](https://discourse.julialang.org/t/behavior-of-cartesianindex-for-bool/25532/1 "2019-06-21T17:52:47Z")

</div>

The documentation of `CartesianIndex` states:

> In particular, `A[I]` is equivalent to `A[i,j,k...]`

Currently it does not hold if `i` etc. is `Bool`. For example:

```julia
julia> x = rand(2,2)
2×2 Array{Float64,2}:
 0.937975 0.7768
 0.92419 0.502304

julia> x[CartesianIndex(true, true)]
0.9379748299581936

julia> x[true, true]
ERROR: ArgumentError: invalid index: true of type Bool

```

I think creating `CartesianIndex` with `Bool` should be disallowed and `Integer` in its constructors should be replaced by `Union{Signed, Unsigned}`, but I wanted to consult this before submitting an issue.
