12.6.1 How to write it
Write ⟦«expresión», «expresión»⟧ ⟦Without Newline⟧;
Read «destino», «destino»;12.6.2 How it works
Write glues the representations of its values without a separator and ends with a line break, unless Without Newline is given. An empty Write writes a blank line.
Read converts every input according to the target's type. If the input does not fit, it warns with readValueTypeMismatch and asks again for the same value without touching the variable. Once Read gives a variable a value, that variable has a value for the initialization check.
ProgramAsking for two numbers
Algorithm Suma
Define a, b As Integer;
Write "Primer número: " Without Newline;
Read a;
Write "Segundo número: " Without Newline;
Read b;
Write a, " + ", b, " = ", a + b;
Write;
Write "fin";
EndAlgorithmInput
3 4
Output
Primer número: Segundo número: 3 + 4 = 7 fin
The program finishes normally.
Read takes values from the input, one per target. Write puts text on the output, on one line unless Without Newline is used.The input holds 3 and 4. Read stores them in a and b. Write shows 3 + 4 = 7 on the output.
If no input is available, execution waits. In the app a field appears to type into; in the terminal standard input is read.
In short
Writejoins values without a separator and breaks the line, unlessWithout Newline.Readasks for one value per target and converts it to the type.- An invalid input is asked for again with a warning.