An if statement can be followed by an optional else statement, which executes when the expression is false.
if … else Statement Syntax
if (expression) { Block of statements; } else { Block of statements; }
if…else Statement – Execution Sequence
Example
/* 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; } }
Previous Page:-Click Here