Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
31
Task/Menu/Oz/menu.oz
Normal file
31
Task/Menu/Oz/menu.oz
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
declare
|
||||
fun {Select Prompt Items}
|
||||
case Items of nil then ""
|
||||
else
|
||||
for
|
||||
Item in Items
|
||||
Index in 1..{Length Items}
|
||||
do
|
||||
{System.showInfo Index#") "#Item}
|
||||
end
|
||||
{System.printInfo Prompt}
|
||||
try
|
||||
{Nth Items {ReadInt}}
|
||||
catch _ then
|
||||
{Select Prompt Items}
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
fun {ReadInt}
|
||||
class TextFile from Open.file Open.text end
|
||||
StdIo = {New TextFile init(name:stdin)}
|
||||
in
|
||||
{String.toInt {StdIo getS($)}}
|
||||
end
|
||||
|
||||
Item = {Select "Which is from the three pigs: "
|
||||
["fee fie" "huff and puff" "mirror mirror" "tick tock"]}
|
||||
|
||||
in
|
||||
{System.showInfo "You chose: "#Item}
|
||||
Loading…
Add table
Add a link
Reference in a new issue