finished ch3

This commit is contained in:
Jasper Ras 2025-08-04 08:46:58 +02:00
parent 5c3e251568
commit 6d09a2a420
9 changed files with 70 additions and 0 deletions

7
ch3/functions/Cargo.lock generated Normal file
View 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
View file

@ -0,0 +1,6 @@
[package]
name = "functions"
version = "0.1.0"
edition = "2024"
[dependencies]

17
ch3/functions/src/main.rs Normal file
View 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
}