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

Quick Question. ')' expected?

Started by Connor_13_, 06 February 2013 - 02:22 PM
Connor_13_ #1
Posted 06 February 2013 - 03:22 PM
I have this math equation for my program and it gives me an error saying it needs a ')'… Im not sure where to put it.

here is my line of code


moves = ((x^2(x - 1))+(((x^2) - x) + 1) + (x^2) + (x + x))
Orwell #2
Posted 06 February 2013 - 03:24 PM
You need to use the multiply operator (*) explicitly.
Like this:

moves = ((x^2)*(x - 1))+(((x^2) - x) + 1) + (x^2) + (x + x)

Edit: This is the same (equivalent) equation, but simplified:

moves = x^3 + x^2 + x + 1