Decision Making
Decision-making statements, also known as conditional statements, determine program direction and flow by specifying boolean expressions evaluated to true or false, enabling or disabling code execution.
- if statement − if and else
‘if and else’ statements check whether a condition is true or false. If the condition is true, it executes some particular set of codes and if the condition is false, it executes some other set of codes.
- if.. else statement − if and else
‘if and else’ statements check whether a condition is true or false. If the condition is true, it executes some particular set of codes and if the condition is false, it executes some other set of codes.
- if.. else if.. statement − Chain 'if and else' statements with extra 'else if' for additional conditions.