# 2.8 Operators and signs

> Operators and signs are the pieces made of symbols, such as `+`, `<=` or `<-`; the engine always reads the longest possible piece.

Web page: https://pseudolearn.app/en/spec/lexico/operadores

> **In one sentence**
>
> Operators and signs are the pieces made of symbols, such as `+`, `<=` or `<-`; the engine always reads the longest possible piece.

## 2.8.1 How it works

Besides words, the language has pieces made of symbols:

| Family | Signs |
| --- | --- |
| Assignment | `<-` |
| Arithmetic | `+` `-` `*` `/` `^` |
| Comparison | `=` `<>` `<` `<=` `>` `>=` |
| Grouping and access | `(` `)` `[` `]` `.` |
| Separators | `,` `;` `:` |

When two pieces could overlap, the engine chooses the **longest** one. That is why `x<-1` reads as `x`, `<-` and `1` (an assignment), while `x < -1` reads as `x`, `<`, `-` and `1` (a comparison with a negative number).

**Figure 2.8-1: The longest piece**

At the top, x stuck to the arrow and the 1 splits into x, the assignment arrow and 1: an assignment. Below, with spaces, it splits into x, less than, minus and 1: a comparison.

The same symbols, split differently, are different pieces. The space decides.

### Program: Assigning is not comparing

```pseudolearn
Algorithm Flecha
  Define x As Integer <- 5;
  x<-1;
  Write x;
  Write x < -1;
  Write x = 1;
EndAlgorithm
```

**Output**

```text
1
false
true
```

*The program finishes normally.*

The assignment `<-` and the comparison `=` are different operators: `<-` stores a value, `=` asks whether two values are equal.

> **Note**
>
> The most common mistake is reading `x = 1` as "x is 1". `=` only asks; storing uses the arrow, which reads "gets".

**In short**
- Symbol pieces form operators and signs.
- The engine always chooses the longest piece.
- `<-` assigns; `=` compares.

**See also**
- [4.7 Precedence and associativity](https://pseudolearn.app/en/spec/expresiones/precedencia.md)
- [5.3 Assignment](https://pseudolearn.app/en/spec/declaraciones/asignacion.md)
