TOML has good support to represent integer numbers.
integersDemo1.toml
a = 10
b = +10
c = -10
d = 0
+ sign for positive numbers is optional, and negative numbers are prefixed with – sign.
Use _ to enhance readability
You can use underscore (_) to enhance readability of large numbers.
largeNumbers.toml
creditCardNumber = 1234_5678_9012_3456
socialSecurityNumber = 999_99_9999
Positive integers can be expressed in binary, octal and hexa notation
numberConversion.toml
binary1 = 0b1111111
oct1 = 0o177
hex1 = 0x7F
Points to note
a. By any chance if an integer is can’t be represented losslessly, an error is thrown.
b. -0 and 0 are treated as 0.
Previous Next Home
No comments:
Post a Comment