## `textinput` -- interactive input of text

#### Introduction

`textinput` allows interactive input of text.

#### Call(s)

`textinput( <prompt1>)`
`textinput( <prompt1,> x1, <prompt2,> x2, ...)`

#### Parameters

`prompt1, prompt2...` | - | input prompts: character strings
`x1, x2...` | - | identifiers

#### Returns

the last input, converted to a character string.

#### Related Functions

`finput`, `fprint`, `fread`, `ftextinput`, `input`, `print`, `read`, `text2expr`, `write`

#### Details

- `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.
- Several input values can be read with a single `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.

- Using a terminal version of MuPAD, the input must be terminated with the control character `<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.
- The input may extend over several lines. In the output string, MuPAD uses the character `\n` (carriage return) to separate lines.
- Input characters with a leading `\` are not interpreted as control characters, but as two separate characters.
- The identifiers `x1` etc. may have values. These are overwritten by `textinput`.
- `textinput` is a function of the system kernel.

#### Example 1

The default prompt is displayed, the input is converted to a character string and returned:

    >> textinput()

          Please enter text input: << myinput >>

                                     "myinput"

#### Example 2

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:

#### Example 3

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:

#### Changes

- no changes

Do you have questions or comments?
Copyright © SciFace Software GmbH & Co. KG 2000