Menu: Difference between revisions

Content deleted Content added
m →‎{{header|Tcl}}: make it clearer that an empty string is returned in the empty-list case
Task modified to state action on input of non integer.
Line 6: Line 6:
* return the string corresponding to the index number.
* return the string corresponding to the index number.


The function should reject out-of-range indices by recreating 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: 'fee fie', 'huff and puff', 'mirror mirror' and 'tick tock' in a list.
The function should reject input that is not an integer or is an out of range integer index by recreating 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: 'fee fie', 'huff and puff', 'mirror mirror' and 'tick tock' in a list.


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]].