Monday, June 24, 2013

An Interesting post about if-else vs Switch

When I was working on if-else statements on netbeans IDE, it gave me an advice to change if-else to switch.

So I googled it why I had to use switch instead of if-else, and heres the answer

http://www.google.co.jp/url?sa=t&rct=j&q=&esrc=s&frm=1&source=web&cd=5&ved=0CFAQFjAE&url=http%3A%2F%2Fwww.ashishpaliwal.com%2Fblog%2F2009%2F08%2Fif-else-vs-switch-%25E2%2580%2593-which-is-better%2F&ei=XAbIUfm8E8ejkAWJ64CYBw&usg=AFQjCNHMSGjKS0cjY_t_rOmKqBuz7VkVEQ&sig2=hVPuZARGnOVwsh0zvc10sw&bvm=bv.48293060,d.dGI

so in short, switch has more performance and readability advantage.



Programming is fun

No comments:

Post a Comment