In what ways does a switch statement differ from an IF statement?



Ans: The if statement is a conditional branch, a branch to other statements if a certain condition or set of conditions is met. The condition can be logical or arithmetic.
 if (A>B)
 if else (C<D)
else j=14x7

 The switch statement (also known as a case statement) can branch to individual statements for a number of conditions or cases. it is more easily understood.
 switch case a>b... case c<d... case j=k... case else.. end
Next Post Previous Post
No Comment
Add Comment
comment url