RosettaCodeData/Task/Menu/Mathematica/menu.math

9 lines
247 B
Text
Raw Permalink Normal View History

2019-09-12 10:33:56 -07:00
textMenu[data_List] := Module[{choice},
If[Length@data == 0, Return@""];
While[!(IntegerQ@choice && Length@data >= choice > 0),
MapIndexed[Print[#2[[1]], ") ", #1]&, data];
choice = Input["Enter selection..."]
];
data[[choice]]
]