The type of an integer literal, say
45, will be automatically inferred from context. But to force it, we add a suffix:
45u8 (without space) will be typed
Note: Size of
usize depend on the architecture. On 32-bit arch, it's 32-bits, and on 64-bit, you guessed it!
If you just write
2.0, it is
f64 by default, unless the type inference determine otherwise!
f32, either define the variable with
f32 type, or suffix the literal:
bool, having values
char, with values written as
'x'. In single quotes, contain a single Unicode Scalar Value, which means that it is valid to have an emoji in it! Here are 3 more examples: