# Negation operator?

**URL:** <https://forum.choiceofgames.com/t/negation-operator/46431>\
**Category:** ChoiceScript Help\
**Created:** [November 20, 2018, 11:12pm UTC](https://forum.choiceofgames.com/t/negation-operator/46431 "2018-11-20T23:12:40Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![zenovarse](https://sea3.discourse-cdn.com/choiceofgames/user_avatar/forum.choiceofgames.com/zenovarse/32/76740_2.png) [@zenovarse](https://forum.choiceofgames.com/u/zenovarse)\
**Post date:** [November 20, 2018, 11:12pm UTC](https://forum.choiceofgames.com/t/negation-operator/46431/1 "2018-11-20T23:12:40Z")

</div>

I’m probably being stupid but how do I do this?

```
*create x true

```

```
*if (NOT x)
  Do something

```

---

<div class="post-metadata">

**Author:** ![sviyagin](https://sea3.discourse-cdn.com/choiceofgames/user_avatar/forum.choiceofgames.com/sviyagin/32/50885_2.png) [@sviyagin](https://forum.choiceofgames.com/u/sviyagin)\
**Post date:** [November 20, 2018, 11:13pm UTC](https://forum.choiceofgames.com/t/negation-operator/46431/2 "2018-11-20T23:13:46Z")

</div>

You basically did it

```
*create x true
*if not (x)
  Something

```

Note: if (x) is true from the beginning, and you never change it (\*set x false), then you’re never going to see the text in the \*if block

---

<div class="post-metadata">

**Author:** ![zenovarse](https://sea3.discourse-cdn.com/choiceofgames/user_avatar/forum.choiceofgames.com/zenovarse/32/76740_2.png) [@zenovarse](https://forum.choiceofgames.com/u/zenovarse)\
**Post date:** [November 20, 2018, 11:15pm UTC](https://forum.choiceofgames.com/t/negation-operator/46431/3 "2018-11-20T23:15:46Z")

</div>

Thanks, you’re a life saver. I just can’t figure that out xD

---

<div class="post-metadata">

**Author:** ![MeltingPenguins](https://sea3.discourse-cdn.com/choiceofgames/user_avatar/forum.choiceofgames.com/meltingpenguins/32/255855_2.png) [@MeltingPenguins](https://forum.choiceofgames.com/u/MeltingPenguins)\
**Post date:** [November 20, 2018, 11:18pm UTC](https://forum.choiceofgames.com/t/negation-operator/46431/4 "2018-11-20T23:18:07Z")

</div>

```
*if (x = false) works too

```

---

<div class="post-metadata">

**Author:** ![Minnow](https://avatars.discourse-cdn.com/v4/letter/m/ed655f/32.png) [@Minnow](https://forum.choiceofgames.com/u/Minnow)\
**Post date:** [November 20, 2018, 11:24pm UTC](https://forum.choiceofgames.com/t/negation-operator/46431/5 "2018-11-20T23:24:03Z")

</div>

You can check against a numeric or string variable as well, this doesn’t require a boolean (true-false) variable.

```
*if item_count != 30
    Your item count is something - anything - other than 30.
*if name != "Marie"
    Your name is not Marie.

```

---

<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:** [November 21, 2018, 1:18am UTC](https://forum.choiceofgames.com/t/negation-operator/46431/6 "2018-11-21T01:18:04Z")

</div>

Also keep in mind that there is a strange bug with the \*if not when using it inside choice options.

> **[If](https://choicescriptdev.fandom.com/wiki/If)**
>
> Let's say we create var1 with the value 10, and var2 with the value 20. We can then use the\*if command to compare them:\*temp var1= 10\*temp var2= 20\*if (var1= var2) 10 is equal to 20!\*finish 10 is not equal to 20!\*finish Obviously that is not correct...

---

<div class="post-metadata">

**Author:** ![Szaal](https://sea3.discourse-cdn.com/choiceofgames/user_avatar/forum.choiceofgames.com/szaal/32/112202_2.png) [@Szaal](https://forum.choiceofgames.com/u/Szaal)\
**Post date:** [November 21, 2018, 8:48am UTC](https://forum.choiceofgames.com/t/negation-operator/46431/7 "2018-11-21T08:48:44Z")

</div>

Hmhm, just for funsies, let’s compile the possible combination.

```
*if not (X)
*if x = false
*if x != true
```
