first commit
This commit is contained in:
commit
a66604eb6c
52 changed files with 790 additions and 0 deletions
7
functions/Cargo.lock
generated
Normal file
7
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
functions/Cargo.toml
Normal file
6
functions/Cargo.toml
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
[package]
|
||||
name = "functions"
|
||||
version = "0.1.0"
|
||||
edition = "2024"
|
||||
|
||||
[dependencies]
|
||||
20
functions/src/main.rs
Normal file
20
functions/src/main.rs
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
/*
|
||||
function is a block or reusable code.
|
||||
defining the function if fn keyword, and every Rust programs starts with this main function.
|
||||
*/
|
||||
fn main() {
|
||||
greet();
|
||||
println!("{}", multiple(5, 5));
|
||||
}
|
||||
|
||||
fn greet() {
|
||||
println!("namaste!")
|
||||
}
|
||||
|
||||
/*
|
||||
[parameterized function]
|
||||
no type given is directly compliation error, so type annotatin is important
|
||||
*/
|
||||
fn multiple(a: i32, b: i32) -> i32 {
|
||||
a * b
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue