2016 Update
This commit is contained in:
parent
948b86eafa
commit
dcf5d15da3
7965 changed files with 139854 additions and 31002 deletions
|
|
@ -1,11 +1,19 @@
|
|||
;Task:
|
||||
Given a prompt and a list containing a number of strings of which one is to be selected, create a function that:
|
||||
|
||||
* prints a textual menu formatted as an index value followed by its corresponding string for each item in the list;
|
||||
* prompts the user to enter a number;
|
||||
* returns the string corresponding to the selected index number.
|
||||
|
||||
<br>
|
||||
The function should reject input that is not an integer or is out of range by redisplaying the whole menu before asking again for a number. The function should return an empty string if called with an empty list.
|
||||
|
||||
For test purposes use the four phrases: “<tt>fee fie</tt>”, “<tt>huff and puff</tt>”, “<tt>mirror mirror</tt>” and “<tt>tick tock</tt>” in a list.
|
||||
For test purposes use the following four phrases in a list:
|
||||
fee fie
|
||||
huff and puff
|
||||
mirror mirror
|
||||
tick tock
|
||||
|
||||
Note: This task is fashioned after the action of the [http://www.softpanorama.org/Scripting/Shellorama/Control_structures/select_statements.shtml Bash select statement].
|
||||
;Note:
|
||||
This task is fashioned after the action of the [http://www.softpanorama.org/Scripting/Shellorama/Control_structures/select_statements.shtml Bash select statement].
|
||||
<br><br>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue