Multiple *or statement

I’m trying to use an *or statement that has about 5 conditions:
*if ((firstname =“Toby”) or (firstname =“Vi”) or (firstname =“Jessy”) or (firstname =“Jason”) or (firstname =“Junior”))

For some reason it’s not working. I looked on the wiki and spent about 2 minutes trying to figure it out before saying “screw it, there’s a perfectly good forum board here. I’ll just ask for help and then get on with my day.”

So…any ideas?

1 Like

I believe you have to separate or operators into groups of two, and can’t throw all five conditions in at once. Try something like *if ((((A or B) or C) or D) or E) where A through E are (firstname = "Toby") through (firstname = "Junior").

Specifically, something like this:

*if (((((firstname = "Toby") or (firstname = "Vi")) or (firstname = "Jessy")) or (firstname = "Jason")) or (firstname = "Junior"))

What was told to me once, was that for each pair of statements, you need an additional set of parenthesis. But an odd number means one hangs out at the end with just one set of parenthesis. So five would look like this:

*if (((firstname = “Toby”) or (firstname = “Vi”)) or ((firstname = “Jessy”) or (firstname = “Jason”))) or (firstname = “Junior”)

Four would just remove the end there.

Three would be:
*if ((firstname = “Toby”) or (firstname = “Vi”)) or (firstname = “Jessy”)

Two again, just takes off the end there.

I don’t know why the extra parenthesis where they go work that way, but they work that way…

5 Likes

To note, though I rarely find the need, even longer chains can be broken down into *if statements under *if statements.

1 Like

I thought there might be a way to simplify it. Thanks for remembering that!

Basically, *if ((A or B) or (C or D)) or E, correct? Again, where A through E are (firstname = "Toby") through (firstname = "Junior"). Both versions seem to work properly in my own ChoiceScript installation, though yours was noticeably easier to type when I tested it.

So… you can name yourself Lucy, then? :confused:

1 Like

Darn it, knew I forgot one

Thank you to everyone who replied. I was able to resolve the issue thanks to the quick responses.

1 Like

I tried to explain it in this thread, which some have found helpful:

2 Likes