Choicescript help (if and variables)

Need help with some coding.
This is what i have:

*if ((((Gender = "Male") or (Gender = "Female")) and (((background = "suburbs") and ((kind > funny) or (kind > mean))))

This is my error:

“Invalid expression, expected CLOSE_PARENTHESIS”

Try

*if (((blah) and (blah2)) and (blah3))

1 Like

Thanks for the quick response :slight_smile:
But would that work with “or” as well?

Yes, that should work with or as well.

I tried it:

*if (((Gender = "Male") or (Gender = "Female")) and (background = "suburbs") and (kind > funny) or (kind > mean))

and i got this:

“Invalid expression at char 76, expected CLOSE_PARENTHESIS, was: NAMED_OPERATOR [and]”

Try:

*if((Gender=“Male”) or ((Gender=“Female”) and (background=“suburbs”)) and ((kind > funny) or (kind>mean)))

Right, with four variables it’s a bit different–takes some getting used to! I do my best to avoid four, actually, because the parenthesis get nutty.

1 Like

Thanks for helping out too :smiley:

I did as you said:

*if ((Gender = "Male") or ((Gender = "Female") and (background = "suburbs")) and ((kind > funny or kind > mean)))

I got the same error:

“Invalid expression at char 76, expected CLOSE_PARENTHESIS, was: NAMED_OPERATOR [and]”

I know, but i have no idea how to do make it easier. I’m kind of new to this too.

I got the first right:

*if (((Gender = "Male") and (background = "village")) and ((mean > kind) or (mean > funny)))

I don’t think it gave me an error…

I forgot “(” and “)” in a few places, edited it just now, sorry, I’m on the phone so it’s tricky to write a code :sweat_smile:

1 Like

No worries friend! I appreciate the help you’re giving.

The coding is like this now:

*if ((Gender = "Male") or ((Gender = "Female") and (background = "suburbs")) and ((kind > funny) or (kind > mean)))

And it seems i got the same error:

“Invalid expression at char 76, expected CLOSE_PARENTHESIS, was: NAMED_OPERATOR [and”

:frowning:

Does this work?
*if (((Gender = “Male”) or (Gender = “Female”)) and (background = “suburbs”)) and ((kind > funny) or (kind > mean))

Otherwise, it really depends on what exactly are the units you’re using. For future reference, though, it can only handle two units at a time so what I like to do is bracket off the “or” parts first and combine them into one unit each, and then start bracketing the “and” statements together.

5 Likes

IT WORKED! Thank you so much! <3
I would hug you if i could!

Maaan, i love this community… :smile:

3 Likes

Hope this helps. Read down for an example combining ands with ors…

1 Like

Thank you so much for the reply, though I’ve already solved it thanks to some amazing people.
But thank you really for the explanation, I understand this better now!

2 Likes