# operators

### arithmetic

```csharp
5 + 3 // 8
5 - 3 // 2
5 * 3 // 15
5 / 3 // 1.6666...
5 % 3 // 2  (remainder)
-5 // -5  (unary minus)
```

{% hint style="danger" %}
dividing or taking the remainder of anything **by zero is a runtime error** which stops the script and reports exactly which line caused it
{% endhint %}

```csharp
val result = 10 / 0 // runtime error: division by zero
```

### string concatenation

`+` also concatenates when either side is a string, anything else gets automatically converted to text:

```csharp
"Score: " + 10 // "Score: 10"
"Player: " + player.name // "Player: Steve"
"" + 5 // "5" // turns a number into a string
```

### comparisons

```csharp
5 == 5 // true
5 != 3 // true
5 < 10 // true
5 <= 5 // true
5 > 10 // false
5 >= 5 // true
```

`==` works on any value type, including strings and lists

### boolean logic

```csharp
true && false // false (AND)
true || false // true (OR)
!true // false (NOT)
```

### assignment operators

covered in full on [variables & values](variables-and-values.md):

```csharp
= += -= *= /=
```
