Constants that have been initialized have a value. Values exist in different types: 70
is an integer, 3.14
is a float
, and Z
and θ
are the type of a character. Characters are Unicode values that take four bytes of memory each. Godzilla
is a string of type &str
(which is Unicode UTF8 by default), true
and false
are the type of Boolean values. Integers can be written in different formats:
- Hexadecimal format with
0x
, like0x46
for70
. - Octal format with
0o
, like0o106
for70
. - Binary format with
0b
, like0b1000110
.
- Underscores can be used for readability, as in
1_000_000
. Sometimes the compiler will urge you to indicate more explicitly the type of number with a suffix, for example (the number afteru
ori
is the number of memory bits used, namely: 8, 16, 32, or 64). - The
10usize
denotes an unsigned integer of machine word size (usize)
, which can be any of the following types:u8
,u16
,u32
,u64
. - The
10isize
denotes a signed integer of machine word size (isize)
, which can...