Description
By using the if instruction, the Arduino will check whether a certain condition is met, and then execute the corresponding program if the result is ‘true’.
Syntax
if (condition) {
//statement(s)
}
condition: a boolean expression (i.e., can be true or false).
Example code
if( a == 0 )
{
digitalWrite(LEDpin, HIGH); //if the value of parameter a is 0, turn the LED on.
}