What is “The if...else
Statement”?
You can improve the decision-making process by adding a separate argument to the if
statement. When using the if-else
statement, you must run one block of code if the condition is true, and another block of code if it is false. The following is an example of how it could be written:
Syntax:-
if(condition){
// Code to be executed if condition is true
} else{
// Code to be executed if condition is false
}
Example1:- When The Condition is True!
Output:-
Example2:- When The Condition is False!
Output:-