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:-
Latest posts by Ashwani Kumar (see all)
- Top 10 DevOps Trainers in the world - October 7, 2023
- What is Cookies and Why it is Used? - May 24, 2023
- TOP trends of transitions in TikTok - May 10, 2023