Integer Types
Conjure supports both signed and unsigned integers in multiple sizes. The size of each integer type is fixed and does not change based on the platform.
When performing arithmetic operations, Conjure will perform implicit type promotion to the largest type involved in the operation.
i8- 8-bit signed integer (-128 to 127)i16- 16-bit signed integer (-32,768 to 32,767)i32- 32-bit signed integer (-2,147,483,648 to 2,147,483,647)i64- 64-bit signed integer (-9,223,372,036,854,775,808 to 9,223,372,036,854,775,807)u8- 8-bit unsigned integer (0 to 255)u16- 16-bit unsigned integer (0 to 65,535)u32- 32-bit unsigned integer (0 to 4,294,967,295)u64- 64-bit unsigned integer (0 to 18,446,744,073,709,551,615)
var age i32 = 25
var count u64 = 1000000
var byte u8 = 255When declaring integer variables without an explicit type, Conjure will infer the type based on the smallest possible value that can hold the assigned literal.
var smallPositive = 10 // inferred as u8
var smallishNegative = -130 // inferred as i16
var largeNumber = 70000 // inferred as u32Integer Literals
Integer literals can be written in multiple formats. Hexadecimal (0x) and binary (0b) literals are always inferred as unsigned integers unless explicitly typed otherwise or if preceded by a negation operator.
var decimal = 42
var hex = 0xFF // inferred as u8
var binary = -0b1010 // inferred as i8Floating-Point Types
Conjure provides two floating-point types following the IEEE 754 standard:
f32- 32-bit floating-point number (single precision)f64- 64-bit floating-point number (double precision)
Type inference: Floating-point literals without a type annotation default to f64.
var pi f32 = 3.14159
var precise f64 = 3.141592653589793Boolean Type
The bool type represents logical values and can only be true or false. Unlike some languages, integers cannot be used where booleans are expected unless explicitly cast.
var isReady bool = true
var hasError = false // inferred as bool