Quote:
Originally Posted by cbk1994
It makes it clear the previous condition was not true, e.g.
PHP Code:
if (a > 5) { // a is greater than 5 } else if (a < 5) { // a is less than 5 } else { // a must b 5 }
You should use them when appropriate as they make code easier to read.
|
There actually is a difference, though, that you forgot to note.
PHP Code:
foo = true;
bar = true;
if (foo) {
//Hit one
} else if (bar) {
//Hit two
}
Only the first conditional will hit.
PHP Code:
foo = true;
bar = true;
if (foo) {
//Hit one
}
if (bar) {
//Hit two
}
Both will hit.
But seriously, why are we wasting our time on this kid? He clearly has no desire to learn and is stubborn as ****, is he worth any of our time? When I had people teaching me, I literally salivated over the **** they were saying, because I knew they were better than me and they knew what they were doing. Now the table's have turned and I hate seeing idiots like this.