Add tasks for all the new languages
This commit is contained in:
parent
9dc3c2bb62
commit
bba7bfd280
13208 changed files with 134745 additions and 0 deletions
23
Task/Menu/Phix/menu.phix
Normal file
23
Task/Menu/Phix/menu.phix
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
function menu_select(sequence items, object prompt)
|
||||
sequence res
|
||||
integer nres
|
||||
if length(items)=0 then return 0 end if
|
||||
while 1 do
|
||||
for i = 1 to length(items) do
|
||||
printf(1,"%d) %s\n",{i,items[i]})
|
||||
end for
|
||||
|
||||
puts(1,iff(atom(prompt)?"Choice?":prompt))
|
||||
res = scanf(trim(gets(0)),"%d")
|
||||
puts(1,"\n")
|
||||
if length(res)=1 then
|
||||
nres = res[1][1]
|
||||
if nres>0 and nres<=length(items) then exit end if
|
||||
end if
|
||||
end while
|
||||
return nres
|
||||
end function
|
||||
|
||||
constant items = {"fee fie", "huff and puff", "mirror mirror", "tick tock"}
|
||||
integer n = menu_select(items,"Which is from the three pigs? ")
|
||||
printf(1,"You chose %d(%s).\n",{n,items[n]})
|
||||
Loading…
Add table
Add a link
Reference in a new issue