written 5.1 years ago by
teamques10
★ 64k
|
•
modified 5.0 years ago
|
i. break and continue statements
break statement:
The break statement neglects the statement after it in the loop and transfer the control outside the loop.
Operation of break statement in for loop:
for(initialization;condition;inc/dec)
Continue statement:
The continue statement also neglects the statement after it in the loop and transfer the control back to the starting of the loop for next iteration.
Operation of continue statement in for loop:
ii. if-else and switch statements
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. |