Rust - Hello Foo
We use the let
keyword to declare a varible. Thouh we don't have to, we can already assign a value to it using a single equal sign =
as it is done in most programming languages.
In order to print to the sceeen we can use a pair of curly braces {}
as a placeholder for the content of a variable in the println! macro. Behind that macro is another one called the format! macro where you can read more about the various options.
fn main() { let name = "Foo"; println!("Hello {}, how are you?", name); }
The output will look like this:
Hello Foo, how are you?
- let
- println!
- format!