Conditional statements like the
for loop and if statement discussed in this chapter use comparison and logical operators to test for conditions. Comparative operators are used to compare the left side of an expression against the right side to produce a value of true or false. With this piece of information, the Arduino can use it to make decisions depending on the type of control structure being used. So if you wanted to test whether or not a variable held a particular value, you might use an expression like the following:
myValue == 5
Here we use the
== comparative operator to test if the variable or value on the left of the operator is equal to the variable or value on the right. In this case, the expression ...