textinput
-- interactive input
of texttextinput
allows interactive input of text.
textinput( <prompt1>)
textinput( <prompt1,> x1, <prompt2,> x2,
...)
prompt1, prompt2... |
- | input prompts: character strings |
x1, x2... |
- | identifiers |
the last input, converted to a character string.
finput
, fprint
, fread
, ftextinput
, input
, print
, read
, text2expr
, write
textinput
()
displays the prompt
``Please enter text :
'' and waits for input by the user.
The input is converted to a character string, which is returned as the
function's return value.textinput
(prompt1)
uses the character
string prompt1
instead of the default prompt
``Please enter text :
''.textinput
( <prompt1,> x1)
converts
the input to a character string and assigns this string to the
identifier x1
. The default prompt is used, if no prompt
string is specified.textinput
command. Each identifier in the sequence of
arguments makes textinput
return a prompt, waiting for
input to be assigned to the identifier. A character string preceeding
the identifier in the argument sequence replaces the default prompt.
Cf. example 3. Arguments that are neither
prompt strings nor identifiers are ignored.<CTRL-D>
(the
cursor has to be positioned behind the last character of the current
input line). Graphical user interfaces of MuPAD may open a
separate window for reading the input.\n
(carriage return) to
separate lines.\
are not interpreted
as control characters, but as two separate characters.x1
etc. may have values. These are
overwritten by textinput
.textinput
is a function of the system kernel.The default prompt is displayed, the input is converted to a character string and returned:
>> textinput()
Please enter text input: << myinput >> "myinput"
A user-defined prompt is used, the input is assigned to
the identifier x
:
>> textinput("enter your name: ", x)
enter your name: << Turing >> "Turing"
>> x
"Turing"
>> delete x:
If several values are to be read, separate prompts can be defined for each value:
>> textinput("She: ", hername, "He: ", hisname)
She: << Bonnie >> He: << Clyde >> "Clyde"
>> hername, hisname
"Bonnie", "Clyde"
>> delete hername, hisname: