Data types with suffix

Hi. I read docs and find this part " You can write integer literals in any of the forms shown in Table 3-2. Note that all number literals except the byte literal allow a type suffix, such as 57u8 , and _ as a visual separator, such as 1_000 ."

What does it mean "57u8" ?

57u8 means a u8 (unsigned 8-bit integer) with the value of 57.

for example - "let x = 105u8;" ?

That's no different from

let x: u8 = 105;

However 105u8 can be convenient when you are providing a literal to a macro or function, so you can specify the data type at the same time as the literal

1 Like

Thank u very much!