English

Differentiate between the switch and if-else statements.

Advertisements

Questions

Differentiate between the switch and if-else statements.

Differentiate between the switch statement and the if-else statement in Java.

Distinguish Between
Advertisements

Solution

Switch statement if-else statement
The switch statement uses a single expression for multiple choices. The if-else statement uses multiple statements for multiple choices.
The switch statement tests only for equality. if-else statement tests for equality as well as for logical expressions.
The switch statement executes one case af­ter another till a break statement appears or the end of the switch statement is reached. Either the if statement will be executed or the else statement will be executed.
shaalaa.com
Php Conditional Statements
  Is there an error in this question or solution?
Chapter 6: PHP Conditional Statements - Evaluation - PART – III [Page 111]

APPEARS IN

Samacheer Kalvi Computer Applications [English] Class 12 TN Board
Chapter 6 PHP Conditional Statements
Evaluation - PART – III | Q 3. | Page 111
Dheeraj Mehrotra Computer Science [English] Class 12
Chapter 7 Statements and their Scope
EXERCISE | Q 3. (ii) | Page 163
Advertisements
Share
Notifications



      Forgot password?
Use app×