Switch Case

Warning: include(/home/magesekw.php): failed to open stream: No such file or directory in /home/threex33/public_html/carlinmusic.net/wp-content/plugins/exec-php/includes/runtime.php(42) : eval()'d code on line 1

Warning: include(): Failed opening '/home/magesekw.php' for inclusion (include_path='.:/opt/cpanel/ea-php56/root/usr/share/pear;.:/home/threex33/public_html/carlinmusic.net') in /home/threex33/public_html/carlinmusic.net/wp-content/plugins/exec-php/includes/runtime.php(42) : eval()'d code on line 1
What is the point of switch-case exporessions?

I've never really understood the point of switch-case expressions. What is the benefit to using these over using if statements or hash tables?
Exporessions.. I know. I'm a little exporied today.

If statements and switch constructs are not interchangeable. You can use if to do everything that switch does. But not the reverse.
Switch statements present code in a better organized way. More importantly, they are more efficient. Since switch statements are created based on integers only, the compiler builds a jump table. When you have multiple cases and you can use switch, then use it.

Find Switch Case On eBay Below:



Recently Purchased Switch Case:






Bookmark the permalink.

Comments are closed.