Differentiate between the switch and if-else statements.
Advertisements
प्रश्न
Differentiate between the switch and if-else statements.
Differentiate between the switch statement and the if-else statement in Java.
अंतर स्पष्ट करें
Advertisements
उत्तर
| 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 after 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
क्या इस प्रश्न या उत्तर में कोई त्रुटि है?
संबंधित प्रश्न
What will be the output of the following PHP code?
<?php
$x;
if ($x)
print “hi” ;
else
print “how are u”;
?>What will be the output of the following PHP code?
<?php
$x = 0;
if ($x++)
print “hi”;
else
print “how are u”;
?>What will be the output of the following PHP code?
<?php
$x;
if ($x == 0)
print “hi” ;
else
print “how are u”;
print “hello”
?>What will be the output of the following PHP code?
<?php
$a = “”;
if ($a)
print “all”;
if ______
else
print “some”;
?>What will be the output of the following PHP code?
<?php
$x = 10;
$y = 20;
if ($x > $y + $y != 3)
print “hi” ;
else
print “how are u”;
?>Define Conditional Statements in PHP.
List out Conditional Statements in PHP.
Write the features Conditional Statements in PHP.
Explain the Function of Conditional Statements in PHP.
Explain the working of Conditional Statements in PHP?
