Add functions
parent
dd3d781536
commit
268453576d
@ -0,0 +1,8 @@
|
||||
[package]
|
||||
name = "another_function"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
[dependencies]
|
@ -0,0 +1,23 @@
|
||||
fn main() {
|
||||
println!("Hello, world!");
|
||||
another_function(5);
|
||||
print_labeled_measurement(5, 'h');
|
||||
println!("The value of x is -> {}", five());
|
||||
println!("The value of x is -> {}", plus_one(5));
|
||||
}
|
||||
|
||||
fn another_function(x: i32) {
|
||||
println!("The value of x is -> {}", x);
|
||||
}
|
||||
|
||||
fn print_labeled_measurement(value: i32, unit_label: char) {
|
||||
println!("The measurement is: {}{}", value, unit_label);
|
||||
}
|
||||
|
||||
fn five() -> i32 {
|
||||
5
|
||||
}
|
||||
|
||||
fn plus_one(x: i32) -> i32 {
|
||||
x + 1
|
||||
}
|
Loading…
Reference in New Issue