Menu: Difference between revisions
Content added Content deleted
(Better D code) |
|||
Line 712: | Line 712: | ||
choice{"fee fie", "huff and puff", "mirror mirror", "tick tock"}</lang> |
choice{"fee fie", "huff and puff", "mirror mirror", "tick tock"}</lang> |
||
=={{header|Mathematica}}== |
|||
<lang Mathematica>textMenu[data_List] := (Print[ |
|||
Grid[MapIndexed[{#2[[1]], ")", #} &, data]]]; |
|||
While[! (IntegerQ[choice] && Length[data] > choice > 0), |
|||
choice = Input["Enter selection"]]; |
|||
data[[choice]])</lang> |
|||
Use: |
|||
<pre>textMenu[{"fee fie", "huff and puff", "mirror mirror", "tick tock"}]</pre> |
|||
=={{header|MATLAB}}== |
=={{header|MATLAB}}== |