finished ch3
This commit is contained in:
parent
5c3e251568
commit
6d09a2a420
9 changed files with 70 additions and 0 deletions
7
ch3/branches/Cargo.lock
generated
Normal file
7
ch3/branches/Cargo.lock
generated
Normal file
|
|
@ -0,0 +1,7 @@
|
||||||
|
# This file is automatically @generated by Cargo.
|
||||||
|
# It is not intended for manual editing.
|
||||||
|
version = 4
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "branches"
|
||||||
|
version = "0.1.0"
|
||||||
6
ch3/branches/Cargo.toml
Normal file
6
ch3/branches/Cargo.toml
Normal file
|
|
@ -0,0 +1,6 @@
|
||||||
|
[package]
|
||||||
|
name = "branches"
|
||||||
|
version = "0.1.0"
|
||||||
|
edition = "2024"
|
||||||
|
|
||||||
|
[dependencies]
|
||||||
9
ch3/branches/src/main.rs
Normal file
9
ch3/branches/src/main.rs
Normal file
|
|
@ -0,0 +1,9 @@
|
||||||
|
fn main() {
|
||||||
|
let number = 3;
|
||||||
|
|
||||||
|
if number < 5 {
|
||||||
|
println!("condition was true");
|
||||||
|
} else {
|
||||||
|
println!("condition was false");
|
||||||
|
}
|
||||||
|
}
|
||||||
7
ch3/functions/Cargo.lock
generated
Normal file
7
ch3/functions/Cargo.lock
generated
Normal file
|
|
@ -0,0 +1,7 @@
|
||||||
|
# This file is automatically @generated by Cargo.
|
||||||
|
# It is not intended for manual editing.
|
||||||
|
version = 4
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "functions"
|
||||||
|
version = "0.1.0"
|
||||||
6
ch3/functions/Cargo.toml
Normal file
6
ch3/functions/Cargo.toml
Normal file
|
|
@ -0,0 +1,6 @@
|
||||||
|
[package]
|
||||||
|
name = "functions"
|
||||||
|
version = "0.1.0"
|
||||||
|
edition = "2024"
|
||||||
|
|
||||||
|
[dependencies]
|
||||||
17
ch3/functions/src/main.rs
Normal file
17
ch3/functions/src/main.rs
Normal file
|
|
@ -0,0 +1,17 @@
|
||||||
|
fn main() {
|
||||||
|
another_function(10);
|
||||||
|
print_labeled_measurements(5, 'h');
|
||||||
|
another_function(five());
|
||||||
|
}
|
||||||
|
|
||||||
|
fn another_function(x: i32) {
|
||||||
|
println!("The value of x is {x}");
|
||||||
|
}
|
||||||
|
|
||||||
|
fn print_labeled_measurements(value: i32, unit_label: char) {
|
||||||
|
println!("The measurement is: {value}{unit_label}");
|
||||||
|
}
|
||||||
|
|
||||||
|
fn five() -> i32 {
|
||||||
|
5
|
||||||
|
}
|
||||||
7
ch3/loops/Cargo.lock
generated
Normal file
7
ch3/loops/Cargo.lock
generated
Normal file
|
|
@ -0,0 +1,7 @@
|
||||||
|
# This file is automatically @generated by Cargo.
|
||||||
|
# It is not intended for manual editing.
|
||||||
|
version = 4
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "loops"
|
||||||
|
version = "0.1.0"
|
||||||
6
ch3/loops/Cargo.toml
Normal file
6
ch3/loops/Cargo.toml
Normal file
|
|
@ -0,0 +1,6 @@
|
||||||
|
[package]
|
||||||
|
name = "loops"
|
||||||
|
version = "0.1.0"
|
||||||
|
edition = "2024"
|
||||||
|
|
||||||
|
[dependencies]
|
||||||
5
ch3/loops/src/main.rs
Normal file
5
ch3/loops/src/main.rs
Normal file
|
|
@ -0,0 +1,5 @@
|
||||||
|
fn main() {
|
||||||
|
loop {
|
||||||
|
println!("Hello, world!");
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue