Read in formatted data
from the active input stream.
procedure read(e1:expr[, e2:expr...])
procedure readln(e1:expr[, e2:expr...])
Expression or list of expressions of basic type
The following reads (possible split over several lines) 12 45 word, followed by toto(12 and 45)=word:
ts:array (range,range) of string
read(i, j, s)
readln("toto(", i, "and", j, ")=", ts(i,j))
1. These procedures assign the data read from the active
input stream to the given symbols or try to match the given expressions
with what is read from the input stream.
is a symbol that can be assigned a value,
the procedure tries to recognise from the input stream a constant
of the required type and, if successful, assigns the resulting
value to ei
. If ei
is a constant or a symbol
that cannot be reassigned, the procedure tries to read in a constant
of the required value and succeeds if the resulting value corresponds
. These procedures do not fail but set the
control parameter nbread
to the number of items
2. Note that the read procedures
are based on the lexical analyser of Mosel: items are separated
by spaces and a string that contains spaces must be quoted
using either single or double quotes
(the quotes are automatically removed once the string has been
3. The procedure readln expects all the items to be
recognized to be contained in single line. The function
read ignores changes of line.
If the procedure readln is used without parameters it skips
the end of the current line.
If you have any comments or suggestions about these pages,
please send mail to firstname.lastname@example.org.
© Copyright 2001-2013 Fair Isaac Corporation. All rights reserved.