Jump to content

Menu: Difference between revisions

651 bytes added ,  10 years ago
Added zkl
(Added zkl)
Line 1,970:
Please enter 1 thru 4: 2
huff and puff
</pre>
 
=={{header|zkl}}==
<lang zkl>fcn teleprompter(options){
os:=T("exit").extend(vm.arglist); N:=os.len();
if(N==1) return("");
while(1){
Utils.zipWith(fcn(n,o){"%d) %s".fmt(n,o).println()},[0..],os);
a:=ask("Your choice: ");
try{ n:=a.toInt(); if(0<=n<N) return(os[n]); } catch{}
println("Ack, not good");
}
}
 
teleprompter("fee fie" , "huff and puff" , "mirror mirror" , "tick tock")
.println();</lang>
{{out}}
<pre>
0) exit
1) fee fie
2) huff and puff
3) mirror mirror
4) tick tock
Your choice: abc
Ack, not good
0) exit
1) fee fie
2) huff and puff
3) mirror mirror
4) tick tock
Your choice: 3
mirror mirror
</pre>
 
Anonymous user
Cookies help us deliver our services. By using our services, you agree to our use of cookies.