Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
34
Task/Menu/Nanoquery/menu.nanoquery
Normal file
34
Task/Menu/Nanoquery/menu.nanoquery
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
def _menu($items)
|
||||
for ($i = 0) ($i < len($items)) ($i = $i + 1)
|
||||
println " " + $i + ") " + $items[$i]
|
||||
end
|
||||
end
|
||||
|
||||
def _ok($reply, $itemcount)
|
||||
try
|
||||
$n = int($reply)
|
||||
return (($n >= 0) && ($n < $itemcount))
|
||||
catch
|
||||
return $false
|
||||
end
|
||||
end
|
||||
|
||||
def selector($items, $pmt)
|
||||
// Prompt to select an item from the items
|
||||
if (len($items) = 0)
|
||||
return ""
|
||||
end
|
||||
$reply = -1
|
||||
$itemcount = len($items)
|
||||
while !_ok($reply, $itemcount)
|
||||
_menu($items)
|
||||
println $pmt
|
||||
$reply = int(input())
|
||||
end
|
||||
return $items[$reply]
|
||||
end
|
||||
|
||||
$items = list()
|
||||
append $items "fee fie" "huff and puff" "mirror mirror" "tick tock"
|
||||
$item = selector($items, "Which is from the three pigs: ")
|
||||
println "You chose: " + $item
|
||||
Loading…
Add table
Add a link
Reference in a new issue