Arduino - Déclaration If… else

Un if L'instruction else peut être suivie d'une instruction else facultative, qui s'exécute lorsque l'expression est fausse.

if… else Syntaxe de l'instruction

if (expression) {
   Block of statements;
}
else {
   Block of statements;
}

Instruction if… else - Séquence d'exécution

Exemple

/* Global variable definition */
int A = 5 ;
int B = 9 ;

Void setup () {

}

Void loop () {
   /* check the boolean condition */
   if (A > B) /* if condition is true then execute the following statement*/ {
      A++;
   }else {
      B -= A;
   }
}