> For the complete documentation index, see [llms.txt](https://hopemoore.gitbook.io/coding-for-creatives-spring-2021/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://hopemoore.gitbook.io/coding-for-creatives-spring-2021/glossary-and-terms/variables/data-types/boolean-or-bool.md).

# Boolean or Bool

## Description

* **`true`** or **`false`**
* Represented also as **`1`** (true) or **`0`** (false)
* Whether it’s capitalized depends on the language
* Great for control and sensors

**Examples:**

*Processing:*

```java
boolean lightOn = false;
```

*C#*

```csharp
bool lightOn = false;
```

*JavaScript*

```javascript
var gameOver = true;
```

&#x20; *Python:*

```python
gameOver = False
```

## Shortcut

Using an exclamation mark ( `!` ) at the beginning of a boolean variable name is short for “the opposite” of the variable

{% hint style="warning" %}
This does **not** update the variable.
{% endhint %}

**Examples:**

*Processing and Java-based example:*

```java
boolean lightOn = false;

println(lightOn); // Prints “false” to console
println(!lightOn); // Prints “true” to console

```

*C# example:*

```csharp
bool lightOn = false;

print(lightOn); // Prints “false” to console
print(!lightOn); // Prints “true” to console

```

{% hint style="warning" %}
This "shortcut" might not exist in Python.
{% endhint %}
