# Parenthesis check. Having a random brain day (Solved)

**URL:** <https://forum.choiceofgames.com/t/parenthesis-check-having-a-random-brain-day-solved/6129>\
**Category:** ChoiceScript Help\
**Created:** [November 30, 2014, 12:03pm UTC](https://forum.choiceofgames.com/t/parenthesis-check-having-a-random-brain-day-solved/6129 "2014-11-30T12:03:57Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Pyromanci](https://sea3.discourse-cdn.com/choiceofgames/user_avatar/forum.choiceofgames.com/pyromanci/32/2340_2.png) [@Pyromanci](https://forum.choiceofgames.com/u/Pyromanci)\
**Post date:** [November 30, 2014, 12:03pm UTC](https://forum.choiceofgames.com/t/parenthesis-check-having-a-random-brain-day-solved/6129/1 "2014-11-30T12:03:57Z")

</div>

Hi, I may just be being paranoid. But would appreciate a more experienced coder having a peek.

\*if ((((var = false) and (var = true)) and (var = “female”)) or (var = “both”))

I am hoping this is a command that dictates the first two variables must meet the conditions, but either of the last two will do to make it valid. Can someone let me know if I have messed up the parenthesis please? I know there were other posts on parenthesis, but they all seemed to contain or or and, no combinations. So please don’t beat me if this has been covered.

---

<div class="post-metadata">

**Author:** ![Havenstone](https://sea3.discourse-cdn.com/choiceofgames/user_avatar/forum.choiceofgames.com/havenstone/32/198451_2.png) [@Havenstone](https://forum.choiceofgames.com/u/Havenstone)\
**Post date:** [November 30, 2014, 12:19pm UTC](https://forum.choiceofgames.com/t/parenthesis-check-having-a-random-brain-day-solved/6129/2 "2014-11-30T12:19:46Z")

</div>

I assume that “var” actually represents a bunch of different variables? Might be clearer for examples like this if you differentiate them e.g. (var1=true) and (var2=false).

I think what you’ve got there is in danger of triggering if the last variable is “both”, regardless of what’s happening with the other variables. For what you describe, I suspect this would work better:

\*if ((var1 = false) and (var2 = true)) and ((var3 = “female”) or (var3 = “both”))

Note that if var3 is a sexual orientation variable with three possible values (male, female, or both), you could more simply use (var3 != “male”) instead of =“female” or =“both”. The exclamation point means not, i.e. var3 is not equal to male.

Have a look at this post for a walkthrough of a mixed or/and condition:

> [@Is it possible... (making or/and statements with 3+ variables)](https://forum.choiceofgames.com/t/is-it-possible-making-or-and-statements-with-3-variables/2411/11):
>
> Glad it’s handy. slight_smile Since you mention and statements, it’s worth noting that they’re a little bit trickier, because the order matters. Don’t know if this example will be helpful to anyone at all, but here’s a stab: If everything is an or, then each variable is equally important in the outcome. Imagine a game with some true/false variables that describe how our companion Dex has developed over the course of the story so far: Will you vote for Dex as leader of the party? \*if (axe\_…

---

<div class="post-metadata">

**Author:** ![Pyromanci](https://sea3.discourse-cdn.com/choiceofgames/user_avatar/forum.choiceofgames.com/pyromanci/32/2340_2.png) [@Pyromanci](https://forum.choiceofgames.com/u/Pyromanci)\
**Post date:** [November 30, 2014, 12:23pm UTC](https://forum.choiceofgames.com/t/parenthesis-check-having-a-random-brain-day-solved/6129/3 "2014-11-30T12:23:06Z")

</div>

Many thanks. All your assumptions were correct, and those parenthesis make much more sense. Also for the exclamation mark. I didn’t know it could be used that way. It did seem like a lot of work to set if her boyfriend is dead and you aren’t sleeping with her friend she will hit on you if your orientation is correct. I don’t know why I bothered adding in orientation anyway. Should have just left it as a free for all… Thanks again.
