Difference Between If Else Statement And Switch Statement in Tabular Form

Sno.Basic TermsIf Else StatementSwitch Statement
2.WorkingIf Condition is true display some message otherwise display other messageSwitch Statement is similar to a series of If Statements on the same expression
3.Programming LanguageC,Cpp,Java,php etcC,Cpp,Java ,php
4.Data Type SupportInteger, Character, Pointer or Floating-point type or Boolean typeonly character or a integer datatype
5.NestingPopular for nesting of a loopNot as popular for nesting of a loop
6.UnderstandingIf more conditions are used, it is more difficult to understandEven if the number of conditions increase, switch statement is still easier to understand
7.Flow Chart

If Else Flow Chart Diagram
If Else Flow Chart Diagram

Switch Flow Chart Diagram
Switch Flow Chart Diagram

(Visited 13 times, 1 visits today)

Written by: