Literals & quoting
Integer literals
FullWhole numbers of unbounded size, written in decimal or any radix.
An integer literal denotes an Int — an arbitrary-precision signed integer. There is no fixed width and no silent overflow: an integer grows as large as it needs to, limited only by memory.
Decimal literals #
The plain form is a run of decimal digits. Underscores may be inserted between digits as visual separators; they are ignored.
say 42; say 1_000_000;
Output
42
1000000An underscore is only allowed between two digits — not leading, trailing, or doubled.1_000is fine;_1,1_, and1__0are parse errors.
Radix prefixes #
Binary, octal, and hexadecimal literals are written with a 0b, 0o, or 0x prefix. Hex digits are case-insensitive.
say 0xFF; say 0o17; say 0b1010;
Output
255
15
10Arbitrary radix #
The :radix<digits> form writes a literal in any base from 2 to 36. The digits above 9 are the letters a–z.
say :16<ff>; say :2<1010>;
Output
255
10Unbounded size #
Integer arithmetic never overflows into an approximate result — the value stays exact however large it gets.
say 2 ** 100; say (10 ** 30).WHAT;
Output
1267650600228229401496703205376
(Int)Notes #
- The type is always
Int; there is no separate machine-word integer type at the language level. (Nativeintexists only as an explicit container type.) - A leading
-is the numeric negation operator applied to the literal, not part of the literal itself — this matters only in rare precedence corners.