Menu: Difference between revisions

433 bytes added ,  14 years ago
Added Common Lisp.
(add Ruby)
(Added Common Lisp.)
Line 59:
sel$ = ret$
end function</lang>
=={{header|Common Lisp}}==
<lang lisp>(defun select (prompt choices)
(if choices
(do
(n)
((and n (<= 0 n (1- (length choices)))) (nth n choices))
(format t "~a~%" prompt)
(loop
for n from 0
for c in choices
do (format t " ~d) ~a~%" n c))
(finish-output)
(setf n (parse-integer
(read-line *standard-input* nil)
:junk-allowed t)))
""))</lang>
 
=={{header|Java}}==
<lang java5>public static String select(List<String> list, String prompt){
845

edits