input to complete
This function prompts a message on the screen (asking for user input) and then expects user input for a variable.
In addition, given contents can be provided which the user can complete, edit or rewrite entirely.
Type and value checking can be enabled if needed, e.g. numbers only, integers with in a specific range, etc.
This function is very similar to input() except that an additional function parameter in the 1st place
is available to provide the initial text contents.
Note: In batch mode, the initial text will not be used.
Indirect parameter passing is disabled.
1-4
No. | Type | Description |
---|---|---|
1 input |
valid types | Initial contents The intial contents will be provided after the prompt and can be completed, modified or replaed by other input. Non-string values such as numbers will be converted to strings first. |
2 input |
string | Prompt The prompt will be displayed before input is requested |
Opt. 3 input |
string | Checked value type See 2nd function parameter in input(). Default value: string |
Opt. 4 code |
comparison expression :string |
Validation expression If the entered value does not match with the type, then the user will be requested to repeat the input.
|
Type | Description |
---|---|
valid types | Entered value The value entered is returned, using the appropriate type. |
a[] = input("The weather is ", "Please complete following sentence: ", string );
echo("Entered value is : ", a[]," The type is : ", type (a[]) );