Activity 2.22

Source Code

-- define main function
function main()
    print("Main Function")
    local choice = nil
    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 == "Q" then
        done = true
    else
        print("Invalid Choice")
    end
end

-- define Example 1 Function


-- define Example 2 Function


-- define Example 3 Function


-- define Example 4 Definition


-- call main function
main()

Last updated

Was this helpful?