Knowledge Garden

Search

Search IconIcon to open search

Integer Literals in Rust

Last updated Dec 1, 2022 Edit Source

# Integer literals

namevalue
Decimal10000
Hex0xdeadbeef
Octal0o77543211
Binary0b1111011
Byte(u8 only)b’A'

Term u8 and byte are used interchangably in rust

namevalue
Decimal1_000_000
Hex0xdead_beef
Octal0o7754_3211
Binary0b1111_011
Byte(u8 only)b’A'

Underscores are ignored and can be used for readability