# Using "or" and "and" together in if statement

**URL:** <https://forum.choiceofgames.com/t/using-or-and-and-together-in-if-statement/118016>\
**Category:** ChoiceScript Help\
**Created:** [May 9, 2022, 3:00pm UTC](https://forum.choiceofgames.com/t/using-or-and-and-together-in-if-statement/118016 "2022-05-09T15:00:44Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![G-Man](https://sea3.discourse-cdn.com/choiceofgames/user_avatar/forum.choiceofgames.com/g-man/32/255484_2.png) [@G-Man](https://forum.choiceofgames.com/u/G-Man)\
**Post date:** [May 9, 2022, 3:00pm UTC](https://forum.choiceofgames.com/t/using-or-and-and-together-in-if-statement/118016/1 "2022-05-09T15:00:44Z")

</div>

I’m having trouble with: I need a sexuality check for a “school romance” scene, so MC can attempt to date both (male and female) options. This sets their “sexuality” value “both”. Problem is, both characters desire exlcusive relationships so I want them to see “They both wanted an exclusive relationship, which I wasn’t interested.” option (“greed” value is for choosing “I wanna date both” option, it is a modifier that can unlock one of endings if it’s high enough). However, due to “sexuality” value being set as “both”, if you choose “I wanna date both” you can still see Amy and Chris options.

The error I’m getting is: I’m using CSIDE, it says it expected nothing after

```nohighlight
"if (sexuality = "Women") or (sexuality = "Both")"

```

. The thing I tried was (poly being a temp value I created just for this, I don’t think I have patience or desire to write a polyamorous relationship)

```nohighlight
"if (sexuality = "Women") or (sexuality = "Both") and (poly = true)"

```

My current code looks like this:

```nohighlight
*choice
    *if (sexuality = "Women") or (sexuality = "Both")
        #Yes, I can't believe Amy said yes!
            *set romance "Amy"
            *goto incident
    *if (sexuality = "Women") or (sexuality = "Both")
        #No, she said she was dating someone else.
            *goto incident
    *if (sexuality = "Men") or (sexuality = "Both") and
        #Yes, Chris said he had a crush on me too!
            *set romance "Chris"
            *goto incident
    *if (sexuality = "Men") or (sexuality = "Both") and
        #No, he wanted to be friends.
            *goto incident
    *if (sexuality = "Both") and (greed = 1)
        #They both wanted an exclusive relationship, which I wasn't interested.
            *goto incident
    *if (sexuality = "Both") and (greed = 0)
        #I tried my chance with both, but they said no.
            *goto incident
    #I didn't try
        *goto incident

```

TL:DR I’m trying to make it so if you choose “I’m bi and I’ll try my chances with both” then you can see “Amy” and “Chris” options, if you choose “I wanna date both at the same time” then you see “Nah they’re not interested”.

---

<div class="post-metadata">

**Author:** ![malinryden](https://sea3.discourse-cdn.com/choiceofgames/user_avatar/forum.choiceofgames.com/malinryden/32/272913_2.png) [@malinryden](https://forum.choiceofgames.com/u/malinryden)\
**Post date:** [May 9, 2022, 3:02pm UTC](https://forum.choiceofgames.com/t/using-or-and-and-together-in-if-statement/118016/2 "2022-05-09T15:02:34Z")

</div>

> [@G-Man](#):
>
> `(sexuality = "Women") or (sexuality = "Both")`

You need another set of parentheses that surrounds the two!

```choicescript
((sexuality = "Women") or (sexuality = "Both"))

```

---

<div class="post-metadata">

**Author:** ![G-Man](https://sea3.discourse-cdn.com/choiceofgames/user_avatar/forum.choiceofgames.com/g-man/32/255484_2.png) [@G-Man](https://forum.choiceofgames.com/u/G-Man)\
**Post date:** [May 9, 2022, 3:08pm UTC](https://forum.choiceofgames.com/t/using-or-and-and-together-in-if-statement/118016/3 "2022-05-09T15:08:06Z")

</div>

Thank you! I should’ve read “if” page on wiki more throughly…

---

<div class="post-metadata">

**Author:** ![malinryden](https://sea3.discourse-cdn.com/choiceofgames/user_avatar/forum.choiceofgames.com/malinryden/32/272913_2.png) [@malinryden](https://forum.choiceofgames.com/u/malinryden)\
**Post date:** [May 9, 2022, 3:08pm UTC](https://forum.choiceofgames.com/t/using-or-and-and-together-in-if-statement/118016/4 "2022-05-09T15:08:29Z")

</div>

Just glad this one was easy to solve 🙂

---

<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:** [May 9, 2022, 5:05pm UTC](https://forum.choiceofgames.com/t/using-or-and-and-together-in-if-statement/118016/5 "2022-05-09T17:05:44Z")

</div>

I dont think you do, actually? CS can deal with two things at a time: [Is it possible... (making or/and statements with 3+ variables) - #8 by Havenstone](https://forum.choiceofgames.com/t/is-it-possible-making-or-and-statements-with-3-variables/2411/8)

What it can’t deal with is

- three things at a time, e.g. `(sexuality = "Women") or (sexuality = "Both") or (sexuality = "Poly")` – in that case you’d need to chuck a couple of them inside a parenthesis
- orphan bits of code – for example the stray “and” at the end of `*if (sexuality = "Men") or (sexuality = "Both") and`

I think in the code shared here, it’s the second one that’s the problem.

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/choiceofgames/original/3X/e/f/efe1497a762edecdb6d569a1c4abee87508bf002.png) [@system](https://forum.choiceofgames.com/u/system)\
**Post date:** [May 10, 2022, 5:05pm UTC](https://forum.choiceofgames.com/t/using-or-and-and-together-in-if-statement/118016/6 "2022-05-10T17:05:47Z")

</div>

This topic was automatically closed 24 hours after the last reply. If you want to reopen your WiP, contact the moderators.
