diff options
Diffstat (limited to 'rust/functions')
| -rw-r--r-- | rust/functions/Cargo.lock | 7 | ||||
| -rw-r--r-- | rust/functions/Cargo.toml | 9 | ||||
| -rw-r--r-- | rust/functions/src/main.rs | 19 |
3 files changed, 35 insertions, 0 deletions
diff --git a/rust/functions/Cargo.lock b/rust/functions/Cargo.lock new file mode 100644 index 0000000..82f83a1 --- /dev/null +++ b/rust/functions/Cargo.lock @@ -0,0 +1,7 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 3 + +[[package]] +name = "functions" +version = "0.1.0" diff --git a/rust/functions/Cargo.toml b/rust/functions/Cargo.toml new file mode 100644 index 0000000..046807f --- /dev/null +++ b/rust/functions/Cargo.toml @@ -0,0 +1,9 @@ +workspace = { members = ["branches"] } +[package] +name = "functions" +version = "0.1.0" +edition = "2021" + +# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html + +[dependencies] diff --git a/rust/functions/src/main.rs b/rust/functions/src/main.rs new file mode 100644 index 0000000..d246d2c --- /dev/null +++ b/rust/functions/src/main.rs @@ -0,0 +1,19 @@ +fn main() { + println!("Hello, world!"); + another_function(5, 'Y'); + println!("FOO: {}", foo()); + println!("PlusOne: {}", plus_one(5)); +} + +fn another_function(x:i32, y:char) { + println!("The value of x is: {x} and y is: {y}"); +} + +// This kaboom +fn foo() -> i32 { + 3+5; +} + +fn plus_one(x: i32) -> i32 { + x + 1 +} |
