## `Pref::promptString` -- user defined ``prompt''

#### Introduction

`Pref::promptString` determines the string, that will be printed in front of any input line--the ``prompt''.

#### Call(s)

`Pref::promptString( <prompt>)`

#### Parameters

`prompt` | - | string, that contains the ``prompt'', or `NIL`

#### Returns

the last defined string

#### Related Functions

`Pref::prompt`, `Pref::postInput`, `Pref::postOutput`

#### Details

- `Pref::promptString` changes the user ``prompt''.
- The ``prompt'' is the string, that will be printed in front of each input line to mark it as input line.
- The prompt can be extended to display additional information. In joint with `Pref::postInput` and `Pref::postOutput` the ``prompt'' can be formed alterable (see example 2).
- A call of `Pref::promptString` without arguments returns the current value. The argument `NIL` will reset the default value, which is `»> "`.

#### Example 1

Prints out the current prompt:

    >> Pref::promptString()

                                       ">> "

#### Example 2

`Pref::promptString` will be used to numerate the input lines in joint with `Pref::postInput`. I.e., after each input the variable `NumberOfLine` will be incremented. The variable `NumberOfLine` must be initialized with `0`. (This all could be done in the file ```userinit.mu`''.)

    >> NumberOfLine:= 0:
       Pref::postInput(proc()
                       begin
                         NumberOfLine:= NumberOfLine + 1;
                         Pref::promptString(expr2text(NumberOfLine) . " >> ")
                       end_proc):

#### Changes

- no changes

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