Advertisement Remove all ads

Compare the Followingif-else and Switch Statements - Structured Programming Approach

Distinguish Between

Compare the following

if-else and switch statements

Advertisement Remove all ads


Sr. no. If……else Switch
1 In this we can test only one condition. In this we can test multiple condition.
2 It can have values based on constraints. It can have values based on user choice.
3 In this we cannot have different conditions. In this case we can have only one expression but various value of the same expression.
4 If else statement is used to evaluate a condition to be true or false A switch case statement is used to test for multiple values of the same variable or expression like 1,2,3 etc.


  Is there an error in this question or solution?
Advertisement Remove all ads


Advertisement Remove all ads
Advertisement Remove all ads

View all notifications

      Forgot password?
View in app×