Menu: Difference between revisions
Content added Content deleted
Line 2,487: | Line 2,487: | ||
menu: function [items][ |
menu: function [items][ |
||
print until [ |
print either empty? items [""] [until [ |
||
repeat n length? items [print [n ":" items/:n]] |
repeat n length? items [print [n ":" items/:n]] |
||
attempt [pick items to-integer ask "Your choice: "] |
attempt [pick items to-integer ask "Your choice: "] |
||
] |
]] |
||
]</lang> |
|||
] |
|||
menu ["fee fie" "huff and puff" "mirror mirror" "tick tock"]</lang> |
|||
{{out}} |
{{out}} |
||
<pre> |
<pre>>> menu ["fee fie" "huff and puff" "mirror mirror" "tick tock"] |
||
1 : fee fie |
|||
2 : huff and puff |
2 : huff and puff |
||
3 : mirror mirror |
3 : mirror mirror |
||
4 : tick tock |
4 : tick tock |
||
Your choice: |
Your choice: azerty |
||
1 : fee fie |
1 : fee fie |
||
2 : huff and puff |
2 : huff and puff |
||
Line 2,511: | Line 2,511: | ||
4 : tick tock |
4 : tick tock |
||
Your choice: 3 |
Your choice: 3 |
||
mirror mirror |
mirror mirror |
||
>> menu [] |
|||
>> </pre> |
|||
=={{header|REXX}}== |
=={{header|REXX}}== |