The if is always true

  • Arduino C++
  • JavaScript
  • PictoBlox blocks don't have this

Why it happens

  • if (x = 1) was typed instead of if (x == 1). It compiles with no error.

How to fix it

  1. Use == inside every if.
  2. Also check there's no ; straight after if (…): it ends the if before its block.

It worked if: Change the input: the code now does both things, one for yes and one for no.

From how the part works. A C++ language rule; it gives no error message.

Didn't help? Search another error or ask us.