Week 17
Source Code
local myName = ""
print("Name: " .. myName)
-- define main function
function main()
print("Main Function")
local done = false
local choice = nil
while not done do
print("Menu")
print("E1 - Example 1")
print("Q - Quit")
io.write("Choice: ")
choice = io.read()
if choice == "E1" then
-- call Example 1 Function
elseif choice == "E2" then
-- call Example 2 Function
elseif choice == "E3" then
-- call Example 3 Function
elseif choice == "E4" then
-- call Example 4 Function
elseif choice == "E5" then
-- call Example 5 Function
elseif choice == "E6" then
-- call Example 6 Function
elseif choice == "E7" then
-- call Example 7 Function
elseif choice == "Q" then
done = true
else
print("Invalid Choice")
end
end
end
-- define Example 1 Function
-- define Example 2 Function
-- define Example 3 Function
-- define Example 4 Function
-- define Example 5 Function
-- define Example 6 Function
-- define Example 7 Function
-- call main function
main()w17problem1.lua
w17problem2.lua
w17problem3.lua
w17problem4.lua
w17problem5.lua
w17problem6.lua
w17problem7.lua
w17problem8.lua
w17problem9.lua
project2.lua
Last updated
Was this helpful?