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

7
modules-file/Cargo.lock generated Normal file
View file

@ -0,0 +1,7 @@
# This file is automatically @generated by Cargo.
# It is not intended for manual editing.
version = 4
[[package]]
name = "modules-file"
version = "0.1.0"

6
modules-file/Cargo.toml Normal file
View file

@ -0,0 +1,6 @@
[package]
name = "modules-file"
version = "0.1.0"
edition = "2024"
[dependencies]

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;