How do these practically differ?
// Approach one
if (x == 1)
DoSomething();
else if (x == 2)
DoSomethingElse();
// Approach two
if (x == 1)
DoSo
When you code like this
// approach two
if (x == 1)
DoSomething();
if (x == 2)
DoSomethingElse();
Everytime the condition checks.
But when you code like this
if (x == 1)
DoSomething();
else if (x == 2)
DoSomethingElse();
If the first condition is true then it wont check next else if condition and thus decrease unnecessary compiling.