Types
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:
Press + to interact
fn main() {let name: &str = "Michael";println!("My name is {}", name);}
Rust has something called ...
Access this course and 1400+ top-rated courses and projects.