Menu: Difference between revisions

Content added Content deleted
m (formatting of external link)
(Added BASIC)
Line 11: Line 11:


Note: This task is fashioned after the action of the [http://www.softpanorama.org/Scripting/Shellorama/Control_structures/select_statements.shtml Bash select statement].
Note: This task is fashioned after the action of the [http://www.softpanorama.org/Scripting/Shellorama/Control_structures/select_statements.shtml Bash select statement].
=={{header|BASIC}}==
{{works with|QuickBasic|4.5}}
<lang qbasic> function sel$(choices$(), prompt$)
if ubound(choices$) - lbound(choices$) = 0 then sel$ = ""
ret$ = ""
do
for i = lbound(choices$) to ubound(choices$)
print i; ": "; choices$(i)
next i
input ;prompt$, index
if index <= ubound(choices$) and index >= lbound(choices$) then ret$ = choices$(index)
while ret$ = ""
sel$ = ret$
end function</lang>
=={{header|Java}}==
=={{header|Java}}==
<lang java5>public static String select(List<String> list, String prompt){
<lang java5>public static String select(List<String> list, String prompt){