Help with a compilation error in Arduino

Hello! I have a code that says expected primary - expression before " = " token. I have written the code within asteriks where the mistake occurs. Could someone please help me figure out what the mistake is? Thanks

  **if ((x >=20 || x < = -20) && (y >=20 || y <= -20) && (z >= 20 || z < = -20)**  
    & ((millis()/1000) - endTimer - sleepTimerInterruption > 8) ) 

The compiler told exactly where the problem is - why didn't you share that obvious item of information?

Right there

 if ((x >=20 || x < = -20) && (y >=20 || y <= -20) && (z >= 20 || z < = -20)

this is where the error occurrs

What changes should I make to not get the error? I don't understand why I am getting the error

That one is correct.
See the difference?

Oh is it the spacing?

Yup

Oh alright. Thank you so much!!

Just a heads-up for any beginners following…
C based languages regard ‘white space’ (or the lack of) very strictly.

It is used to delimit fields, operators etc, so a stray space or tab can impact your code without being immediately visible.

C whitespace

Thank you for the clarification

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.