Week 17
Source Code
local myName = ""
print("Name: " .. myName)
-- define main function
-- define Example 1 Function
-- define Example 2 Function
-- call main function (do not remove!)
main function
function main()
print("Hello 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
print("Example 1")
-- call Example 1 Function
elseif choice == "E2" then
print("Example 2")
-- call Example 2 Function
elseif choice == "Q" then
done = true
else
print("Invalid Choice")
end
end
end
Last updated