2.7.1 How it works
Texts are written between quotes. Double quotes "…" and single quotes '…' mean the same. What decides the type is how many characters are inside:
- Exactly one: it is a character (
Character). - None, or more than one: it is a string (
String).
At the top, A between single quotes and between double quotes both lead to the Character type. Below, empty quotes and a two-letter text lead to the String type.
Inside a text, the backslash starts an escape sequence to write special characters:
| Escape | Meaning |
|---|---|
\n | line break |
\t | tab |
\r | carriage return |
\\ | one backslash |
\" | double quote |
\' | single quote |
ProgramQuotes and escapes
Algorithm Escapes
Define inicial As Character <- 'A';
Write "Primera línea\nSegunda línea";
Write "Dijo: \"hola\"";
Write 'Comillas simples', " y la inicial ", inicial;
EndAlgorithmOutput
Primera línea Segunda línea Dijo: "hola" Comillas simples y la inicial A
The program finishes normally.
In short
- Double or single quotes: they mean the same.
- One character inside:
Character. Zero or several:String. - Escapes:
\n,\t,\r,\\,\"and\'.