|
<< Click to Display Table of Contents >> ACCEPT |
![]() ![]()
|
ACCEPT is used to show a dialog box in Gekko, where a scalar value can be input. See also PAUSE.
Syntax
ACCEPT type variable message;
type |
Choose between val, date or string. For string type, you do not need to enclose the input (in the dialog box) in quotes. |
variable |
The name of the variable |
message |
Text string to be displayed. You can use \n to insert a new line. |
Examples
The statement may contain text inside single quotes:
accept string %n 'Variable name'; |
The four ACCEPT-input might be the following:
'Input variable name' --> vat 'Input label --> Value added tax 'Input date' --> 2016 'Input value' --> 0.25 |
This will create the series vat, with the label 'Value added tax', and the value 0.25 in 2016.
If you need to accept list items, you may accept them as a comma-separated string, and afterwards use the split() function to split the string into a list of strings.
To control program flow dynamically depending upon user input, you may use code like the following:
accept string %yesno 'Do you want to proceed? (y/n, default: n)'; |
A dialog box is shown, and if the user just presses [Enter], %yesno will be an empty string, and the program does not proceed. The program only proceeds when the user inputs y or Y (Gekko string comparisons are case-insensitive).
Related statements