input
This function prompts a message on the screen (asking for user input) and then expects user input for a variable. Type and value checking can be enabled if needed, e.g. numbers only, integers with in a specific range, etc.
Indirect parameter passing is disabled.
0-3
No. | Type | Description | ||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1 input |
string | Prompt The prompt will be displayed before input is requested | ||||||||||||||||
Opt. 2 input |
string | Checked value type Use one of the following values:
If the entered value does not match with the type, then the user will be requested to repeat the input. Default value: string | ||||||||||||||||
Opt. 3 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("Enter both date and time: ", date and time );
echo("Entered value is : ", a[]," The type is : ", type (a[]) );
a[] = input("Enter any value: ");
echo("Entered value is : ", a[]," The type is : ", type (a[]) );
a[] = input("Enter any integer greater than or equal to 3: ", integer, >=3);
echo("Entered value is : ", a[]," The type is : ", type (a[]) );
a[] = input("Enter one lower-case latin character: ", character, 'a'..'z');
echo("Entered value is : ", a[]," The type is : ", type (a[]) );
a[] = input("Enter a boolean value (true, false, y, n, ... ): ", boolean);
echo("Entered value is : ", a[]," The type is : ", type (a[]) );
a[] = input("Enter a date in 2020: ", date, date(01.01.2020)..date(31.12.2020) );
echo("Entered value is : ", a[]," The type is : ", type (a[]) );
a[] = input("Enter a time before 15:00 ", time, <time("15:00") );
echo("Entered value is : ", a[]," The type is : ", type (a[]) );