# Select all boolean variables in one keyword

**URL:** <https://discourse.processing.org/t/select-all-boolean-variables-in-one-keyword/28908>\
**Category:** Coding Questions\
**Created:** [March 27, 2021, 6:17pm UTC](https://discourse.processing.org/t/select-all-boolean-variables-in-one-keyword/28908 "2021-03-27T18:17:05Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![freddukas](https://avatars.discourse-cdn.com/v4/letter/f/ea5d25/32.png) [@freddukas](https://discourse.processing.org/u/freddukas)\
**Post date:** [March 27, 2021, 6:17pm UTC](https://discourse.processing.org/t/select-all-boolean-variables-in-one-keyword/28908/1 "2021-03-27T18:17:06Z")

</div>

hello everyone.

is there a trick or a solution to interact with all boolean variables in one keyword ?

I hope something like " all.boolean == true" .

I think I already saw something like this but I can’t remember exactly.

do we have a way to do this or is it just a dream ??

Thanks a lot for your help

Fred

---

<div class="post-metadata">

**Author:** ![CodeMasterX](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/codemasterx/32/2942_2.png) [@CodeMasterX](https://discourse.processing.org/u/CodeMasterX)\
**Post date:** [March 27, 2021, 6:53pm UTC](https://discourse.processing.org/t/select-all-boolean-variables-in-one-keyword/28908/2 "2021-03-27T18:53:23Z")

</div>

> [@freddukas](#):
>
> interact with all boolean variables

I don’t fully understand what you mean, but yeah.

Do you mean to check for multiple booleans and see if they are true?

You can do that by using && simbols. It means AND. So print( 1 \< 2 && 4 != 5) would print out “true”

Alternatively you can make a function comparring all of the inputs. (Here is one I wrote (not tested yet, but it should work)

```auto
boolean check(boolean desired, boolean... inputs) {
   for(int i = 0; i < inputs.length; i++) if(inputs[i] != desired) return false;
   return true:
}

```

---

<div class="post-metadata">

**Author:** ![freddukas](https://avatars.discourse-cdn.com/v4/letter/f/ea5d25/32.png) [@freddukas](https://discourse.processing.org/u/freddukas)\
**Post date:** [April 7, 2021, 3:52pm UTC](https://discourse.processing.org/t/select-all-boolean-variables-in-one-keyword/28908/3 "2021-04-07T15:52:38Z")

</div>

Hello,  
Sorry I just saw your answer, thanks a lot.I will check your ideas.

---

<div class="post-metadata">

**Author:** ![Chrisir](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/chrisir/32/45_2.png) [@Chrisir](https://discourse.processing.org/u/Chrisir)\
**Post date:** [April 7, 2021, 6:49pm UTC](https://discourse.processing.org/t/select-all-boolean-variables-in-one-keyword/28908/4 "2021-04-07T18:49:53Z")

</div>

> [@freddukas](#):
>
> I hope something like " all.boolean == true" .

remember

- that `==` is for comparison in if: `if(boolMy == true) {...` and
- that = is for assignment: `boolMy = true;` sets boolMy to true

**Remark 1**

technically, `if(boolMy == true)` is not necessary, you can say `if(boolMy) { ....`

When you have a few booleans you want  
`if(boolMy1 && boolMy2 && boolMy3 && boolMy4) {....`

**Remark 2**

when you have multiple booleans, maybe have them in an array (which is a list) then you can for loop over them

Chrisir
