D (The Programming Language)/d2/Type Conversion

=Lesson 5: Type Conversion= In this lesson, you will learn how the types of variables can be implicitly and explicitly converted.

Implicit Integral Conversions
An object of an integral type can be converted to another object of an integral type as long as the destination type is wider than the original type. These conversions are implicit:

⇒   ⇒    ⇒    ⇒    ⇒    ⇒    ⇒    ⇒

Explicit Conversions
Casting is a way to tell the compiler to try to force an object to change type. In D, you do this by writing.

Tips

 * You cannot convert an integral value to a string (or the other way around) with a cast. There is a library function which you will learn later for that.