top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

When is a switch statement better than multiple if statements?

+3 votes
334 views
When is a switch statement better than multiple if statements?
posted Feb 1, 2016 by Maha Lakshmi

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

1 Answer

0 votes

If program just comparing integers switch statement can be used while if () statement can be used for integer as well as for non-integer values. Logic point of view, both switch () { } and if () statements have same level of cyclometic complexity.

answer Feb 1, 2016 by Vimal Kumar Mishra
...