# How to inverse a Boolean vector?

**URL:** <https://discourse.julialang.org/t/how-to-inverse-a-boolean-vector/70309>\
**Category:** General Usage\
**Tags:** question\
**Created:** [October 24, 2021, 10:58pm UTC](https://discourse.julialang.org/t/how-to-inverse-a-boolean-vector/70309 "2021-10-24T22:58:14Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![leon](https://avatars.discourse-cdn.com/v4/letter/l/dc4da7/32.png) [@leon](https://discourse.julialang.org/u/leon)\
**Post date:** [October 24, 2021, 10:58pm UTC](https://discourse.julialang.org/t/how-to-inverse-a-boolean-vector/70309/1 "2021-10-24T22:58:14Z")

</div>

I have an Index that is generated as below:

```julia
Flag = ["A", "B", "C"]
Ind = cmp.(Flag, "A")

```

The results:

```julia
3-element Vector{Int64}:
 0
 1
 1

```

However, what I need is to find where the "A"s are, so I want the inverse values of Ind. I tried both `!Ind` and `.!Ind`, unfortunately, neither of them works. There must be a way to inverse these Boolean values in Julia, am I right?

---

<div class="post-metadata">

**Author:** ![rafael.guerra](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/rafael.guerra/32/216610_2.png) [@rafael.guerra](https://discourse.julialang.org/u/rafael.guerra)\
**Post date:** [October 24, 2021, 11:06pm UTC](https://discourse.julialang.org/t/how-to-inverse-a-boolean-vector/70309/2 "2021-10-24T23:06:32Z")

</div>

> [@leon](#):
>
> `3-element Vector{Int64}:`

Note that what was produced by `cmp` is not a boolean vector.

You may use `findall()`:

```julia
Flag = ["A", "B", "C", "A"]
findall(x-> x=="A", Flag)

```

Or to get a BitVector: `"A" .== Flag`
