0
What is the defference between else and default blocks?
C++
3 Answers
+ 2
switch operator has no āelseā. It has cases and the default case that is used when no other cases match
+ 1
Manuprasad Kp
else is used with if condition.
if(true) {
//will execute if true
} else {
//will execute when if case failed
}
default is used in switch case. If any case will not satisfy the condition then default case will be execute.
0
else is for if statement.
default is for switch.
They're usage is basically the same, but they're used in different terms.