0

What is the defference between else and default blocks?

C++

13th Mar 2021, 9:34 AM
Manuprasad Kp
Manuprasad Kp - avatar
3 Answers
+ 2
switch operator has no ā€œelseā€. It has cases and the default case that is used when no other cases match
13th Mar 2021, 9:36 AM
Sveta Z.
Sveta Z. - avatar
+ 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.
13th Mar 2021, 10:35 AM
AĶ¢J
AĶ¢J - avatar
0
else is for if statement. default is for switch. They're usage is basically the same, but they're used in different terms.
13th Mar 2021, 9:41 AM
ä½ ēŸ„é“č¦å‰‡ļ¼Œęˆ‘也ę˜Æ
ä½ ēŸ„é“č¦å‰‡ļ¼Œęˆ‘也ę˜Æ - avatar