finished ch3 started on ch4

This commit is contained in:
2024-12-26 20:08:24 -07:00
parent 2aceb5c3d0
commit af7f91dce1
5 changed files with 137 additions and 6 deletions

View File

@ -0,0 +1,6 @@
[package]
name = "functions_rust"
version = "0.1.0"
edition = "2021"
[dependencies]

View File

@ -0,0 +1,15 @@
fn main() {
println!("Hello, world!");
example_function(1, 4); // can be delared before or after function that uses it
}
// fn is the keyword for functions
fn example_function (x:i8, y:u16) {
// type must be delared cannot be inferred
// name of parameter/argument is in the brakets seperated by commas
// {} show scope of function
// can be used directly form pram delaration
println!("Look anthoer Function {} {y}", x);
}