Integer Formats
When you are specifying an integer value, either as a constant or as part of a variables definition, you need to specify the base. The base defines the type of value for the integer, and can be:
- Decimal—Decimal values can use negative and positive signs, no signs, or underscores to represent commas. For example:
-2100, 2100, +2100, 2_100.
- Binary—Binary values are base 2 values. You need to use 2# to indicate that the values are base 2, and you need a value for each bit. For example:
2#1111_1111 is 255 (8 bits)
2#0000_1110 is 14 (8 bits)
- Octal—Octal values are base 8 values. You need to use 8# to indicate that the values are base 8, for example:
8#377 is 255
8#030 is 24.
- Hexadecimal—Hexadecimal values are base 16 values. You need to use 16# to indicate that the values are base 16, for example:
16#FF is 255
16#B8 is 184
Further Information