Gosu primitive types

Gosu supports the following primitive types: int, char, byte, short, long, float, double, boolean. Additionally, Gosu supports null, which is a special value that means an empty object value. This set of primitive types is the full set that Java supports.

Every Gosu primitive type (other than the special value null) has an equivalent object type that the Java language defines. For example, for int there is the java.lang.Integer type that descends from the Object class. This category of object types that represent the equivalent of primitive types are called boxed primitive types. In contrast, primitive types are also called unboxed primitives. In most cases, Gosu converts between boxed and unboxed primitives in typical code. However, they are slightly different types, just as in Java, and on rare occasion these differences are important, especially with respect to the ability to represent null.

Boxed primitives can represent null but unboxed primitives cannot represent null. Converting a boxed primitive to an unboxed primitive has a special behavior if the variable or expression has the value null at run time. For Boolean values, the null becomes false. For numeric values, the null becomes 0 or the closest equivalent, such as the char value 0.