# Operators

V bietet die folgenden Operatoren:

## Grundlegende Operatoren

* `+`:
  * Arithmetik: Addition von `int`, `float`
  * `string`-Konkatenation.
* `-` Subtraktion von `int` und `float`.
* `*` Multiplikation von `int` und `float`.
* `/` Division von `int` und `float`.
* `%` Modulo-operator: Ganzzahlige Teilung mit Rest `int`.
* `=` Zuweisung eines Wertes für eine Variable.
* `:=` Deklaration und Initialisierung einer Variable.

```
println(3 + 5)
println(2.0 + 5.0)
println('hello' + 'world')

println(9 - 10)
println(7.0 - 5.0)

println(3 * 5)
println(2.0 * 4)

println(23 / 3)
println(25.0 / 5.0)

println(27 % 5)
println(27 % 3)
```

Output

```
8
7.0
hello world

-1
2.0

15
8.0

7
5.0

2
0
```

> Bemerkung: Im Gegensatz zu anderen (Programmier-) Sprachen kann der `Modulo`-operator (`%`) in V nicht mit `floats` angewandt werden.

## Vergleichsoperatoren

* `>` größer als
* `<` kleiner als
* `==` gleich
* `>=` größer oder gleich
* `<=` kleiner oder gleich
* `!=` ungleich

## Boolsche Operatoren

* `&&` logisches und
* `||` logisches oder
* `!` logisches nicht

## Bitwise Operators

* `<<` bitshift links
* `>>` bitshift rechts
* `&` bitweises Und
* `|` bitweises Oder
* `^` bitweises XOR (exklusives Oder)

## Zuweisungsoperatoren

* `+=` ist äquivalent zu `foo = foo + var`
* `-=` ist äquivalent zu `foo = foo - var`
* `*=` ist äquivalent zu `foo = foo * var`
* `/=` ist äquivalent zu `foo = foo / var`
* `&=` ist äquivalent zu `foo = foo & var`
* `|=` ist äquivalent zu `foo = foo | var`
* `>>=` ist äquivalent zu `foo = foo >> var`
* `<<=` ist äquivalent zu `foo = foo << var`

## Spezielle Operatoren

* `in`: für eine Prüfung ob ein Element Teil einer Sammlung ist.
* `none`: zur Prüfung, ob ein Wert gesetzt wurde.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://v-community.gitbook.io/v-by-example/de/examples/section_2/operator.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
