# 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 %}
