Types
Explore the concept of types in Rust programming, focusing on string literals, integer categories, and type inference. Understand signed and unsigned integers, their bit sizes, and how Rust handles types to write clearer code.
We'll cover the following...
We'll cover the following...
We’ve spoken about numbers and strings. In Rust, every value has a type that tells you what kind of thing it is. When you have a string literal (something between double quotes) like "Hello, world!", its type is &str.
When you use let to declare a variable, you can give its type as well, like this:
Rust has something called type inference, which means that in many cases, you can skip putting in the type, and the compiler will figure it ...