first commit

This commit is contained in:
Ashborn 2025-12-16 22:10:06 +05:45
commit a66604eb6c
52 changed files with 790 additions and 0 deletions

13
modules-file/src/main.rs Normal file
View file

@ -0,0 +1,13 @@
mod math;
mod meth;
fn main() {
// a module is a way to group related code together. You can define modules inline or sepearte
// file
let sum = math::add(2,3);
println!("{}", sum);
//using that nested meth module
let mult = meth::advanced::mult(4, 5);
println!("{}", mult);
}

3
modules-file/src/math.rs Normal file
View file

@ -0,0 +1,3 @@
pub fn add(a:i32, b:i32)->i32{
return a+b;
}

View file

@ -0,0 +1,3 @@
pub fn mult(i:i32, x:i32)->i32{
return i*x;
}

View file

@ -0,0 +1 @@
pub mod advanced;