first commit
This commit is contained in:
commit
a66604eb6c
52 changed files with 790 additions and 0 deletions
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