Always, always remember the double equals

With PHP, Java, etc one of the most basic mistakes you can make is to do a comparission with one equals sign.

x = true

That is always going to equal true because these languages are too lazy to distinquish between assignment and comparission so if you don’t tell it to do a comparission using == it will do an assignment and therfore always come out true.

Timeline

Newsletter

Don't have time to check my blog? Get a weekly email with all the new posts. This is my personal blog, so obviously it is 100% spam free.

Metadata

This entry was posted on Tuesday, February 21st, 2006 at 11:43 am and is filed under Life. You can follow any responses to this entry through the RSS 2.0 feed. Both comments and pings are currently closed.