Menu: Difference between revisions

22 bytes added ,  15 years ago
→‎{{header|Common Lisp}}: force-output suffices, move shorter if case first, indentation, use ~& at beginning of output
(Added Common Lisp.)
(→‎{{header|Common Lisp}}: force-output suffices, move shorter if case first, indentation, use ~& at beginning of output)
Line 61:
=={{header|Common Lisp}}==
<lang lisp>(defun select (prompt choices)
(if (null choices)
(do""
(do (n)
((and n (<= 0 n (1- (length choices)))) (nth n choices))
(format t "~a~%" prompt(nth n choices))
(loopformat t "~&~a~%" prompt)
(loop for n from 0
for c in choices
do (format t " ~d) ~a~%" n c))
(finishforce-output)
(setf n (parse-integer (read-line *standard-input* nil)
:junk-allowed t)))))</lang>
(read-line *standard-input* nil)
:junk-allowed t)))
""))</lang>
 
=={{header|Java}}==