diff --git a/control_flow/src/main.rs b/control_flow/src/main.rs index d8c5a8e..39291b5 100644 --- a/control_flow/src/main.rs +++ b/control_flow/src/main.rs @@ -86,4 +86,24 @@ fn main() { { println!("for loop including: {}",x); } + + //functions + custom_func(); + say_name("John Cena"); + println!("{}", sum(1,5)); } + +fn custom_func() +{ + println!("custom func"); +} + +fn say_name(name: &str) +{ + println!("my name is: {}",name); +} + +fn sum(number1 : i32, number2 : i32) -> i32 +{ + return number1 + number2;a +} \ No newline at end of file