mirror of
https://github.com/idris-lang/Idris2.git
synced 2024-12-30 07:02:24 +03:00
24 lines
501 B
Idris
24 lines
501 B
Idris
|
module UnderscoredIntegerLiterals
|
||
|
|
||
|
-- grouping decimal numbers by thousands
|
||
|
amount : Integer
|
||
|
amount = 10_000_000_000
|
||
|
|
||
|
equalAmounts : Bool
|
||
|
equalAmounts = amount == 10000000000
|
||
|
|
||
|
-- grouping hexadecimal addresses by words
|
||
|
addr : Int
|
||
|
addr = 0xCAFE_F00D
|
||
|
|
||
|
equalAddrs : Bool
|
||
|
equalAddrs = addr == 0xCAFEF00D
|
||
|
|
||
|
-- grouping bits into nibbles in a binary literal
|
||
|
equalFlags : Bool
|
||
|
equalFlags = 0b0011_1111_0100_1110 == 0b0011111101001110
|
||
|
|
||
|
-- grouping octals
|
||
|
equalOctals : Bool
|
||
|
equalOctals = 0o455_777 == 0o455777
|