Programming: == to Test for True of False in a Condition and = is an Assignment Operator
Share
The == (double equals) is a logical operation that returns a true or false. The variable or value is on the left of the == and the test value is on the right. Example: Pressed == 0. That will return true if the Pressed variable is assigned a 0 value. If the Pressed variable is not assigned a 0 value, then the condition will be false and if used in a if {} else {} statement, the code in the else code block will be executed. If a single equals sign = is used, then the variable on the left of the = will be assigned the value on the right.