SELECTION
IF
Syntax :
If (boolean expression) statement;
Or
If (Boolean expression){
Statement 1
Statement 2
}
IF ELSE
Syntax :
If (Boolean expression) statement 1;
Else statement 2;
Or
If (Boolean expression){
Statement 1;
Statement 2;
……
}
Else{
Statement 3;
Statement 4;
}
NESTED IF
Syntax :
If (boolean expression) statement 1;
If (boolean expression) statement 2;
If (boolean expression) statement 3;
Or
If (boolean expression) statement 1;
Else
If (boolean expression) statement 2;
SWITCH CASE
Syntax :
Switch (expression) {
Case constant 1 : statement 1; break;
Case constant 2 :statement 2; break;
default:statement;
}
? : OPERATOR
Is similar to the if statement,but it returns a value.
Syntax : condition ? then – expression : else expression
You can rewrite :
if (a > b)
max_value = a;
else
max_value = b;
as
max_value = (a > b)? a : b;
ERROR TYPE
a.Compile Type : syntax error
b.Link Time : no object code at link time)
c.Run Time : (unsually by numerical operation)
d.Logical : inccorect logical flow/algo