Week 15

Source Code

local myName = ""
print("Name: " .. myName)

-- initialize done to false
local done = false

-- sentinel controlled while loop
while not done do
    -- Menu Options
    print("Menu")
    print("E1 - Example 1")
    print("Q - Quit")
    io.write("Choice: ")
    local choice = io.read()

    if choice == "E1" then
        print("Example 1")
        -- add code here


    elseif choice == "E2" then
        print("Example 2")
        -- add code here


    elseif choice == "E3" then
        print("Example 3")
        -- add code here


    elseif choice == "E4" then
        print("Example 4")
        -- add code here

                
    elseif choice == "E5" then
        print("Example 5")
        -- add code here
        

    elseif choice == "E6" then
        print("Example 6")
        -- add code here
        
 
    elseif choice == "E7" then
        print("Example 7")
        -- add code here
        
 
    elseif choice == "E8" then
        print("Example 8")
        -- add code here
        
        
    elseif choice == "E9" then
        print("Example 9")
        -- add code here
        

    -- Q condition
    elseif choice == "Q" then
        print("Quit!")
        done = true
    -- else condition
    else
        print("Invalid choice")
    end
end

w15problem1.lua

w15problem2.lua

w15problem3.lua

w15problem4.lua

w15problem5.lua

w15problem6.lua

w15problem7.lua

w15problem8.lua

w15problem9.lua

Last updated

Was this helpful?