This week, I started a new series on Tuts+ Code that walks readers through understanding type coercion.

Type Coercion

Type Coercion

Generally speaking, the series of articles starts at the most basic level by discussing strongly typed and weakly typed languages, data types and how they work in different environments, and then begins to branch out more into how data types work within dynamically typed languages.

The main motivation for this is because people who are coming from a strongly-typed background, or those who are just getting into programming may end up finding themselves making a few mistakes especially as it relates to comparisons, conditionals, and other similar evaluations.

This series aims to mitigate that.

Type Coercion

This post is going to serve as a landing page for the series. At this point, the following articles have been published:

  1. Data Types
  2. More come…

Ultimately, the series aims not only to provide information as to how types are managed across various languages, but how comparisons work when the variables being compared aren’t of the same type (which, in turn, leaves the interpreter or the compiler to makes its most educated guess).

Though it’s been somewhat of a hurdle for me in the past, and though different languages may have slightly different rules than, say, JavaScript or PHP, simply understanding how types are managed across languages and how you can avoid some of the pitfalls is helpful.