differentiate between if else and nested if statement?
Answers
Answered by
1
Answer:
First of all both if-else as well as the nested if else are conditional statements i.e; these statements get executed on checking a particular condition. If a condition is true then a set of statements is executed and if the condition is false then another set of statements are executed.
Syntax for if-else
if(condition)
{
// statements
}
else
{
// statements
}
Syntax for nested if-else
if(condition)
{
// statements
}
else if (condition)
{
// statements
}
else if(condition)
{
// statements
}
else
{
// statements
}
Explanation:
Similar questions