Activity 3.4
Source Code
-- define main function
function main()
print("Hello Main Function")
-- create lists
local choice = nil
print("Menu")
print("E1 - Example 1")
print("Q - Quit")
io.write("Choice: ")
choice = io.read()
if choice == "E1" then
-- Example 1 Function call
example1()
elseif choice == "E2" then
-- Example 2 Function call
example2()
elseif choice == "Q" then
done = true
else
print("Invalid Choice")
end
end
-- define Example 1 Function
function example1()
-- double quotes
-- single quotes
-- \n is a newline
-- Lua multi-line string using double brackets
-- length
-- .upper()
-- .lower()
end
-- define Example 2 Function
function example2()
local major = "Computer Science"
print(major)
-- .sub()
-- .find()
-- loop and print every character
end
-- call to main function, do not delete!
main()a34problem1.lua
a34problem2.lua
a34problem3.lua
Last updated
Was this helpful?