Thread: Chat System
View Single Post
  #15  
Old 12-24-2011, 06:47 PM
Hezzy002 Hezzy002 is offline
Registered User
Join Date: Jul 2011
Posts: 247
Hezzy002 is a jewel in the roughHezzy002 is a jewel in the rough
Quote:
Originally Posted by cbk1994 View Post
It makes it clear the previous condition was not true, e.g.

PHP Code:
if (5) {
 
// a is greater than 5
} else if (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.
Reply With Quote