# Expected no more tokens found NAMED\_OPERATOR, or Fun with Parentheses

**URL:** <https://forum.choiceofgames.com/t/expected-no-more-tokens-found-named-operator-or-fun-with-parentheses/63001>\
**Category:** ChoiceScript Help\
**Created:** [August 22, 2019, 7:43pm UTC](https://forum.choiceofgames.com/t/expected-no-more-tokens-found-named-operator-or-fun-with-parentheses/63001 "2019-08-22T19:43:33Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![kashidol](https://sea3.discourse-cdn.com/choiceofgames/user_avatar/forum.choiceofgames.com/kashidol/32/96765_2.png) [@kashidol](https://forum.choiceofgames.com/u/kashidol)\
**Post date:** [August 22, 2019, 7:43pm UTC](https://forum.choiceofgames.com/t/expected-no-more-tokens-found-named-operator-or-fun-with-parentheses/63001/1 "2019-08-22T19:43:33Z")

</div>

Ok this is the line of code that’s giving me the error

```
*if ((week = "Monday") or (week = "Tuesday")) or ((week = "Wednesday") or (week = "Thursday")) or (week = "Friday")

```

My best guess is that there are to many things to keep track of and if that’s the case I need a new way to code this. Could any body help?

Just in case you need the section the help you solve it here you go

```
*label 1_week

*gosub minute
*gosub hour
*gosub day
*gosub week
*gosub month

You check your phone. 
*if (minute < 10)
 Today is ${week}, ${month} ${day}. The time is ${hour}:0${minute}${midday}.
*if (minute > 9)
 Today is ${week}, ${month} ${day}. The time is ${hour}:${minute}${midday}.

*if ((week = "Saturday") or (week = "Sunday"))
 *choice
   #Nothing yet
    *goto 1_week
*if ((week = "Monday") or (week = "Tuesday")) or ((week = "Wednesday") or (week = "Thursday")) or (week = "Friday")
 *choice
   *selectable_if ((hour <= 8) and (hour >= 7)) and (midday = am) #Go to school. (Would anybody care if i didn't go?)
    *set minute +30
    *goto school

   #Go to 24-mart (30 min)
    *set minute +30
    *goto 24

   #Sleep (passes 8 hours)
    *set hour +8
    *goto 1_week

   #Open bedside drawer (Inventory)
    *goto bed

```

---

<div class="post-metadata">

**Author:** ![Lan](https://sea3.discourse-cdn.com/choiceofgames/user_avatar/forum.choiceofgames.com/lan/32/80851_2.png) [@Lan](https://forum.choiceofgames.com/u/Lan)\
**Post date:** [August 22, 2019, 7:59pm UTC](https://forum.choiceofgames.com/t/expected-no-more-tokens-found-named-operator-or-fun-with-parentheses/63001/2 "2019-08-22T19:59:58Z")

</div>

Or can only compare two statements at once. So if you want two compare three or more statements, you need to put parenthesis around each or statement.

(A or B)

((A or B) or C)

(((A or B) or C) or D)

Etc.

So in your case you need 4 sets of parenthesis, not counting the parenthesis around each `week = "something"` statement:

```
*if (((((week = "Monday") or (week = "Tuesday")) or (week = "Wednesday")) or (week = "Thursday")) or (week = "Friday"))

```

---

<div class="post-metadata">

**Author:** ![kashidol](https://sea3.discourse-cdn.com/choiceofgames/user_avatar/forum.choiceofgames.com/kashidol/32/96765_2.png) [@kashidol](https://forum.choiceofgames.com/u/kashidol)\
**Post date:** [August 22, 2019, 8:03pm UTC](https://forum.choiceofgames.com/t/expected-no-more-tokens-found-named-operator-or-fun-with-parentheses/63001/3 "2019-08-22T20:03:51Z")

</div>

It told me that out expected no more token but found a close parentheses.

---

<div class="post-metadata">

**Author:** ![GoldenSilver](https://sea3.discourse-cdn.com/choiceofgames/user_avatar/forum.choiceofgames.com/goldensilver/32/110153_2.png) [@GoldenSilver](https://forum.choiceofgames.com/u/GoldenSilver)\
**Post date:** [August 22, 2019, 8:03pm UTC](https://forum.choiceofgames.com/t/expected-no-more-tokens-found-named-operator-or-fun-with-parentheses/63001/4 "2019-08-22T20:03:56Z")

</div>

You should make a variable to control whether it’s a weekend or not, and then set them accordingly (to false if it’s monday, tuesday, wednesday, thursday or friday, true if saturday or sunday) when a new day starts, then you just read the value of this variable.

```
*create is_weekend false

```

```
*if (is_weekend)
	*comment this is a weekend
*else
	*comment this is a workday

```

With this you can use a simple check to know if it’s a weekend or not.

---

<div class="post-metadata">

**Author:** ![kashidol](https://sea3.discourse-cdn.com/choiceofgames/user_avatar/forum.choiceofgames.com/kashidol/32/96765_2.png) [@kashidol](https://forum.choiceofgames.com/u/kashidol)\
**Post date:** [August 22, 2019, 8:14pm UTC](https://forum.choiceofgames.com/t/expected-no-more-tokens-found-named-operator-or-fun-with-parentheses/63001/5 "2019-08-22T20:14:58Z")

</div>

Okay that issues fixed but now this issue is

```
   *selectable_if ((hour <= 8) and (hour >= 7)) and (midday = am) #Go to school. (Would anybody care if i didn't go?

```

Character 28 was expected no more tokens found close parentheses.

Character 28 I believe is right behind the 8??

---

<div class="post-metadata">

**Author:** ![Gower](https://sea3.discourse-cdn.com/choiceofgames/user_avatar/forum.choiceofgames.com/gower/32/21972_2.png) [@Gower](https://forum.choiceofgames.com/u/Gower)\
**Post date:** [August 22, 2019, 10:35pm UTC](https://forum.choiceofgames.com/t/expected-no-more-tokens-found-named-operator-or-fun-with-parentheses/63001/6 "2019-08-22T22:35:03Z")

</div>

`*selectable_if (((hour = 7) or (hour = 8)) and (midday = am)) #blah`

If how I would do it. The code is much easier to read that way. If I understand correctly, you are trying to just make it 7 or 8. Anyhow, the parentheses should be right in my example above.

For me, the two key parentheses patterns to master are:

((a) and (b))

and

(((a) and (b)) and (x))

Those seem to come up the most.

---

<div class="post-metadata">

**Author:** ![GoldenSilver](https://sea3.discourse-cdn.com/choiceofgames/user_avatar/forum.choiceofgames.com/goldensilver/32/110153_2.png) [@GoldenSilver](https://forum.choiceofgames.com/u/GoldenSilver)\
**Post date:** [August 22, 2019, 11:22pm UTC](https://forum.choiceofgames.com/t/expected-no-more-tokens-found-named-operator-or-fun-with-parentheses/63001/7 "2019-08-22T23:22:14Z")

</div>

Also, might be easier to use a 24 hour time for this, since you won’t need to check am or pm.

---

<div class="post-metadata">

**Author:** ![kashidol](https://sea3.discourse-cdn.com/choiceofgames/user_avatar/forum.choiceofgames.com/kashidol/32/96765_2.png) [@kashidol](https://forum.choiceofgames.com/u/kashidol)\
**Post date:** [August 23, 2019, 12:14am UTC](https://forum.choiceofgames.com/t/expected-no-more-tokens-found-named-operator-or-fun-with-parentheses/63001/8 "2019-08-23T00:14:53Z")

</div>

Thank You both I finally fix the issue. I use parentheses all the time and still run into issues like these😂

---

<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:** [August 24, 2019, 12:14am UTC](https://forum.choiceofgames.com/t/expected-no-more-tokens-found-named-operator-or-fun-with-parentheses/63001/9 "2019-08-24T00:14:58Z")

</div>

Closed on August 24, 2019, 12:14am UTC

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.
