Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- loop = true
- while loop == true do
- textutils.slowPrint("Welcome to EnderCalc Version 0.1!")
- print("Type End to cancel the program")
- print("Would you like to add, subtract, multiply, or divide?")
- local operation = read()
- if operation == "end" or "End" or "e" or "E" or "END" then
- loop = false
- end
- --------------------------------------------------
- function nums()
- print("Enter the first number to be operated on please: ")
- local num1 = tonumber(read())
- print("Enter the second number to be operated on please")
- local num2 = tonumber(read())
- end
- --------------------------------------------------
- if operation == "add" or "ADD" or "a" or "A" then
- nums()
- local result = num1 + num2
- print(result)
- elseif operation == "subtract" or "Subtract" or "s" or "S" then
- nums()
- result = num1 - num2
- print(result)
- elseif operation == "multiply" or "Multiply" or "m" or "M" then
- nums()
- result = num1 * num2
- print(result)
- elseif operation == "divide" or "Divide" or "d" or "D" then
- nums()
- result = num1 / num2
- print(result)
- else
- print("Try again")
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment