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).
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.
ProgramAssigning is not comparing
Algorithm Flecha
Define x As Integer <- 5;
x<-1;
Write x;
Write x < -1;
Write x = 1;
EndAlgorithmOutput
1 false true
The program finishes normally.
The assignment <- and the comparison = are different operators: <- stores a value, = asks whether two values are equal.
In short
- Symbol pieces form operators and signs.
- The engine always chooses the longest piece.
<-assigns;=compares.