Menu: Difference between revisions

Content added Content deleted
(→‎{{header|XPL0}}: Removed error message, and clarified the concern with a comment.)
Line 2,483: Line 2,483:
Which is from the three pigs? 2
Which is from the three pigs? 2
You chose: huff and puff</pre>
You chose: huff and puff</pre>
=={{header|Red}}==
<lang Red>Red ["text menu"]

menu: function [items][
print until [
repeat n length? items [print [n ":" items/:n]]
attempt [pick items to-integer ask "Your choice: "]
]
]
menu ["fee fie" "huff and puff" "mirror mirror" "tick tock"]</lang>

{{out}}

<pre>1 : fee fie
2 : huff and puff
3 : mirror mirror
4 : tick tock
Your choice: dumb
1 : fee fie
2 : huff and puff
3 : mirror mirror
4 : tick tock
Your choice: 7
1 : fee fie
2 : huff and puff
3 : mirror mirror
4 : tick tock
Your choice: 3
mirror mirror</pre>


=={{header|REXX}}==
=={{header|REXX}}==