table menu, table menu quick
This function provides a menu on the console allowing user to select a choice.
table menu supports input choices containing 1 or more characters which need to be typed in and confirmed with pressing [Enter]. Input is case sensitive. In case a wrong selection is entered,
you will be asked to repeat the choice. You can stop running the program by just entering a blank line by pressing [Enter] only.
table menu quick supports input choices containing exactly 1 character which will be accepted without need to press [Enter]. The input is not case sensitive. Execution continus immediately if a
right choice is entered. In addition, The user can stop the program with Escape or Control-C.
Indirect parameter passing is disabled
4
No. | Type | Description |
---|---|---|
1. input |
string | Name of existing table |
2 input |
table column | Input choices Specify the input the user needs to enter to choose the item. For table menu quick, limit to 1 character.
|
3 input |
table column | Description column The description items in the table will be shown when the menu is displayed.
|
4 input |
table column | Selection column The corresponding selection value will be returned after the user has entered the choice.
|
Type | Description |
---|---|
string | Returned selection The selection is the corresponding entry from the selection column in the table. |
table initialize ( menu,
{ { Choice, Description, Selection, Wine },
{ A, Smoked salmon with cherry tomatoes, Fish, Chablais },
{ B, 300g sirloin with baked potatoes, Beef, Cabernet Sauvignon },
{ C, Chicken brest with red curry, Riesling },
{ D, Tirami sù, Dessert, Vin Santo } });
chosen[] = table menu quick( menu, Choice, Description, Selection );
echo("You have chosen ", chosen[] );
echo("We recommend the following wine: ", [menu:Selection,chosen[],Wine] );
A : Smoked salmon with cherry tomatoes
B : 300g sirloin with baked potatoes
C : Chicken brest with red curry
D : Tirami sù
Please select: B
You have chosen Beef
We recommend the following wine: Cabernet Sauvignon