Integer Types
Cangjie provides various integer types: signed integers Int8, Int16, Int32, Int64, IntNative, and unsigned integers UInt8, UInt16, UInt32, UInt64, UIntNative. Int64 is the default integer type—integer literals are inferred as Int64 when there's no type context.
Integer literals support four number systems: decimal (no prefix), hexadecimal (0x or 0X), octal (0o or 0O), and binary (0b or 0B). Underscores _ can be used to separate digits for readability. Type can also be explicitly specified using suffixes i8, i16, i32, i64, u8, u16, u32, u64.
The code on the right demonstrates different integer types and number system representations. 0x2A, 0b101010, and 0o52 are written differently but all equal 42. Try adding let thousand: Int16 = 1000, then change it to let thousand: Int8 = 1000 and observe the overflow error.
IntNative and UIntNative sizes depend on the platform (32-bit or 64-bit), suitable for interoperability with C.