Menu: Difference between revisions

Content added Content deleted
Line 322: Line 322:


=={{header|Lua}}==
=={{header|Lua}}==
<lang lua>function choice(choices)
<lang lua>choices = {"fee fie", "huff and puff", "mirror mirror", "tick tock"}
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[io.read()+0])</lang>
if choices[selection] then print(choices[selection])
else choice(choices)
end
end</lang>

choice{"fee fie", "huff and puff", "mirror mirror", "tick tock"}


=={{header|OCaml}}==
=={{header|OCaml}}==