+2 votes
in Class 12 by kratos

Differentiate Switch and if else statement?

1 Answer

+6 votes
by kratos
 
Best answer

Switch:

  1. Switch statement uses single expression for multiple choices.

  2. If all the cases are not matched default will be ****.

  3. It test only for equality.

  4. It evaluates only for character or integer

If-else:

  1. If else statement uses multiple statement for multiple choices.

  2. Nothing happens.

  3. It tests for equality as well as for logical ‘ expressions.

  4. any data type is allowed.

...