differentiate between if and switch statements
Answers
Answered by
4
If is used to execute a statement or block of statements
Switch .... used to conditionally perform statements based on an integer expression
Switch .... used to conditionally perform statements based on an integer expression
Answered by
0
The if statement evaluates integer, character, pointer or floating-point type or Boolean type. On the other hand, switch statement evaluates only character or an integer data type. Sequence of execution is like either statement under if block will execute or statements under else block statement will execute.
xxxxxxxxxxxxxxxxxxxxxx
Similar questions
Social Sciences,
8 months ago
History,
8 months ago
Math,
1 year ago
Social Sciences,
1 year ago
Social Sciences,
1 year ago
Chemistry,
1 year ago