add functions

This commit is contained in:
Sil Klaasboer
2025-12-18 13:11:54 +01:00
parent 7b9aad5fc8
commit ca2c8bdcc6

View File

@@ -86,4 +86,24 @@ fn main() {
{ {
println!("for loop including: {}",x); 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
} }