Advertisement
DOGGYWOOF

3 option code

Jan 2nd, 2024
7
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.91 KB | None | 0 0
  1. -- Function to display the menu
  2. local function displayMenu()
  3. print("Select an option:")
  4. print("1. Option 1")
  5. print("2. Option 2")
  6. print("3. Option 3")
  7. end
  8.  
  9. -- Function to perform actions based on user input
  10. local function performAction(option)
  11. if option == "1" then
  12. print("You selected Option 1")
  13. -- Add code for Option 1 here
  14. elseif option == "2" then
  15. print("You selected Option 2")
  16. -- Add code for Option 2 here
  17. elseif option == "3" then
  18. print("You selected Option 3")
  19. -- Add code for Option 3 here
  20. else
  21. print("Invalid option. Please select 1, 2, or 3.")
  22. end
  23. end
  24.  
  25. -- Main function to run the program
  26. local function main()
  27. displayMenu() -- Display the menu
  28.  
  29. local option = read() -- Read user input
  30.  
  31. performAction(option) -- Perform action based on user input
  32. end
  33.  
  34. -- Run the program
  35. main()
  36.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement