4.2. Underscores in numbers

Viper also supports underscores in numbers. A single underscore can be used between digits, or between the radix prefix of an integer and the rest of the digits, or, just before the E or e in a floating point literal. Two underscores in a row are not permitted. Underscores cannot go at the start or end of a number, or next to the decimal point. Underscores cannot be used in the exponent. Check this!

Examples:

  0b_11111111 0B111_11111
  0o_777      0O777
  0d_999      0D999
  0x_fFf      0xFFf
  0_777 # DECIMAL (no warning required: viper mode only)
  12_345.657_22_E7
The warning is issued, even for 0_777, because python mode also allows underscores in numbers.