5.6.1 How it works
The engine tells two oversights apart:
| Situation | Warning |
|---|---|
| declared and never used | variableDeclaredNeverUsed |
| assigned but never read | variableAssignedNeverRead |
Both are warnings: they do not prevent running. They usually point to a misspelt name, a result someone forgot to show or a leftover from an earlier version.
ProgramTwo variables too many
Algorithm Limpieza
Define usada As Integer <- 1;
Define olvidada As Integer;
Define escrita As Integer;
escrita <- 5;
Write usada;
EndAlgorithmOutput
1
Diagnostics
variableDeclaredNeverUsed· warning · 3:10 · Variable declared but never used: olvidadavariableAssignedNeverRead· warning · 4:10 · Variable assigned but never read: escrita
The program finishes normally.
A table with three variables. usada is written and read. olvidada is neither written nor read. escrita is written but not read.
Parameters and subprograms nobody uses have their own warnings, with the same idea.
In short
- Declaring and not using, or writing and not reading, produces a warning.
- Warnings do not prevent running.
- They usually point to a name mistake or a forgotten result.