# 2.5 Reserved words

> Reserved words belong to the language itself, such as `If` or `While`; you cannot use them as the name of a variable.

Web page: https://pseudolearn.app/en/spec/lexico/palabras-reservadas

> **In one sentence**
>
> Reserved words belong to the language itself, such as `If` or `While`; you cannot use them as the name of a variable.

## 2.5.1 How it works

Each profile has its list of **reserved words**: those that form the instructions (`If`, `While`, `Write`), the types (`Integer`, `String`), the values (`True`, `False`) and some operators written with letters (`And`, `Or`, `Not`, `Div`, `Mod`). Some are made of several words, such as `Step` or `By Reference`.

**Figure 2.5-1: Families of reserved words**

Six coloured bands: program structure, subroutines, objects, types, boolean values and operators written with letters, each with examples.

Reserved words are grouped by family. Each family's colour is the same one the editor uses.

Several words have **aliases**: other spellings the engine recognises and treats the same. In the Spanish profile, `Proceso` is an alias of `Algoritmo` and `Mostrar` of `Escribir`. The engine accepts aliases, but when formatting or translating it converts them to the main form.

### Program: Accepted aliases

```pseudolearn
Algorithm Alias
  Define hecho As Boolean <- True;
  Write "El alias funciona";
  If Not hecho Or hecho Then
    Write 7 Mod 3;
  EndIf
EndAlgorithm
```

**Output**

```text
El alias funciona
1
```

*The program finishes normally.*

## 2.5.2 Contextual words

Some words are only special in one particular place. For example, `each` only means something inside a for-each loop, and `append` only as a method of a vector. Outside that position they are ordinary names. They are called **contextual words** and do not reserve the name.

> **Common mistakes**
>
> Using a reserved word as a name produces an error that says which one it is:
>
> ### Program: A variable named like a reserved word
>
> ```pseudolearn
> Algorithm Reservada
>   Define If As Integer <- 1;
> EndAlgorithm
> ```
>
> **Diagnostics**
> - `reservedLexemeUsedAsName` (error, 2:10): "If" is a reserved word in this profile, equivalent to if. Choose another name.
>
> *The program finishes with an error.*

**In short**
- Reserved words make up the language and cannot be used as names.
- They ignore case.
- Aliases are accepted and normalised to the main form.
- Contextual words are only special in their position.

**See also**
- [B.1 Reserved words](https://pseudolearn.app/en/spec/apendice/palabras.md)
- [2.4 Identifiers](https://pseudolearn.app/en/spec/lexico/identificadores.md)
