Activity 2.17
Source Code
print("Activity 2.17")
-- 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
-- Q condition
elseif choice == "Q" then
print("Quit!")
done = true
-- else condition
else
print("Invalid choice")
end
end
a217problem1.lua
a217problem2.lua
a217problem3.lua
a217problem4.lua
a217problem5.lua
Last updated
Was this helpful?