This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
GavinTheCrafter's profile picture

Calculator Program won't work (No syntax errors!)

Started by GavinTheCrafter, 25 July 2017 - 02:42 AM
GavinTheCrafter #1
Posted 25 July 2017 - 04:42 AM
Hey,

I've been working on a simple calculator that allows you to add, subtract, multiply, and divide.
The problem is, when I type any of the commands I programmed in, it just refuses to function. For example, I coded it to give help when the "help" command was executed. It doesn't give me any syntax errors, I've debugged every single section of the program, and it just refuses to do anything for me.

Type "pastebin get WtDq3Gew" into your computer to get my code and maybe troubleshoot it.

Thanks! :)/>
Dog #2
Posted 25 July 2017 - 04:53 AM
On line 11 you have…

if input == help then

What you're doing is checking if the variable input is equal to the variable help. What you want to do is check if the variable input is equal to the string "help" (notice the quotes), like so…

if input == "help" then

You have similar errors for your other checks as well. Fix those and the script *should* behave as you expect.
GavinTheCrafter #3
Posted 25 July 2017 - 03:15 PM
On line 11 you have…

if input == help then

What you're doing is checking if the variable input is equal to the variable help. What you want to do is check if the variable input is equal to the string "help" (notice the quotes), like so…

if input == "help" then

You have similar errors for your other checks as well. Fix those and the script *should* behave as you expect.

Thank you! :D/>