If Statement to Finite State Machine
-
"IF condition" needs to be altered to satisfy local variable constraints
If-Else
if( a > b && a > c) { // if else statement
result = a;
} else {
result = c;
}
If Alone
if( a > b && a > c) { // if else statement
result = a;
}
If-Else If-Else
if( a > b && a > c) { // if else statement
result = a;
} else
if( b > a && b > c ){
result = b;
} else
if( b > a && b == c ){
result = c;
} else {
result = d;
}
If-Else If
if( a > b && a > c) { // if else statement
result = a;
} else if( b > a && b > c ){
result = b;
}
If-Else Nested
if( a > b && a > c) { // if else statement
if( b > c) { // if else statement
result = a;
} else {
result = b;
}
} else {
result = c;
}
Edited by Jon Shahen