Anvil | Smiths Smiths | Register Register | Login Login |
Search:
Show links Show tools Show tree | Previous document Next document | njet.org > Anvil > Documentation > Language reference > Lexical analysis > Literals > Integer literals

Integer literals

An integer literal represents a 64-bit integer number, although from the tokenizer's point of view, the negative sign (-) does not belong to the number. Integers can be expressed in four different bases:

Binary number (base 2)
Binary number starts with 0b or 0B and continues with 0, 1.
Octal number (base 8)
Octal number starts with 0 and continues with 0..7.
Decimal number (base 10)
Decimal number starts with 1..9 and continues with 0..9.
Hexadecimal number (base 16)
Hexadecimal number starts with 0x and continues with 0..9, a, A, b, B, c, C, d, D, e, E, f, F.

Examples:
  i = 10;
  netmask = 0xfffffff0;
  flags = 0b00000101;
  x = 010; 
See also  | Literals  | Constants  | Grammar
Contributes notes:
Add a note
What's new | Anvil