Categories
Coding and Logic

Numbers Logic Challenge

I got awesome response to the previous MySQL Challenge. Awesome means, I got 6 responses, out of which 5 are correct (working) solutions and 2 are optimized solutions. You must be thinking, just 6 responses, but I am saying awesome. Yes, in my opinion quality is what matters, not quantity. I will explain the solution to that MySQL challenge in few more days. Before that, I am back with another small problem. This problem deals with numbers and simple mathematical calculations like addition.

Categories
Coding and Logic

Playing with Switches

While coding, you need to control over something, so we have “Control Structures” in our language. Most of the programing language have control structures. And you are building an application, so you (not you exactly, your code) need to make a decision, then your code start comparing things and take the correct decision and moves ahead. It uses conditional statements for comparing stuffs and take action as per the logic. When we say conditional statements, normally some people understand if, else stuff. And they just ignore the switch statement. In many occasions, you may want to compare the same variable (or expression) with many different values, and execute a different piece of code depending on which value it equals to. But I have seen some people using long series of else if/elseif instead using switch. Here I am going to discuss few tricks with the Switches (switch statement).