Menu: Difference between revisions
Content added Content deleted
Line 322: | Line 322: | ||
=={{header|Lua}}== |
=={{header|Lua}}== |
||
<lang lua>function choice(choices) |
|||
⚫ | |||
for i, v in ipairs(choices) do print(i, v) end |
for i, v in ipairs(choices) do print(i, v) end |
||
print"Enter your choice" |
print"Enter your choice" |
||
local selection = io.read() + 0 |
|||
print(choices[ |
if choices[selection] then print(choices[selection]) |
||
else choice(choices) |
|||
end |
|||
end</lang> |
|||
⚫ | |||
=={{header|OCaml}}== |
=={{header|OCaml}}== |