Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
29
Task/Menu/Seed7/menu.seed7
Normal file
29
Task/Menu/Seed7/menu.seed7
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
$ include "seed7_05.s7i";
|
||||
|
||||
const func string: menuSelect (in array string: items, in string: prompt) is func
|
||||
result
|
||||
var string: selection is "";
|
||||
local
|
||||
var string: item is "";
|
||||
var integer: index is 0;
|
||||
var integer: num is 0;
|
||||
begin
|
||||
if length(items) <> 0 then
|
||||
repeat
|
||||
for item key index range items do
|
||||
writeln(index <& ". " <& item);
|
||||
end for;
|
||||
write(prompt);
|
||||
readln(num);
|
||||
until num >= 1 and num <= length(items);
|
||||
selection := items[num];
|
||||
end if
|
||||
end func;
|
||||
|
||||
const array string: items is [] ("fee fie", "huff and puff", "mirror mirror", "tick tock");
|
||||
const string: prompt is "Which is from the three pigs? ";
|
||||
|
||||
const proc: main is func
|
||||
begin
|
||||
writeln("You chose " <& menuSelect(items, prompt));
|
||||
end func;
|
||||
Loading…
Add table
Add a link
Reference in a new issue