added function and variable lessons.
This commit is contained in:
parent
4106843d70
commit
405437686a
6 changed files with 118 additions and 0 deletions
8
the_book/variables/Cargo.toml
Normal file
8
the_book/variables/Cargo.toml
Normal file
|
@ -0,0 +1,8 @@
|
|||
[package]
|
||||
name = "variables"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
[dependencies]
|
12
the_book/variables/src/main.rs
Normal file
12
the_book/variables/src/main.rs
Normal file
|
@ -0,0 +1,12 @@
|
|||
fn main() {
|
||||
let x = 5;
|
||||
|
||||
let x = x + 1;
|
||||
|
||||
{
|
||||
let x = x * 2;
|
||||
println!("The value of x in the inner scope is: {}", x);
|
||||
}
|
||||
|
||||
println!("The value of x is: {}", x);
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue