por valor y por referencia

This commit is contained in:
2023-06-01 15:45:55 +02:00
parent cc4a953382
commit 9d9c7e21bb
4 changed files with 37 additions and 0 deletions

8
porvalor/Cargo.toml Normal file
View File

@@ -0,0 +1,8 @@
[package]
name = "porvalor"
version = "0.1.0"
edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]

9
porvalor/src/main.rs Normal file
View File

@@ -0,0 +1,9 @@
fn agregar(a: i32, b: i32) -> i32 {
// como no tiene punto y coma este dato es retornado
a + b
}
fn main() {
let valor = agregar(3, 5);
println!("{}", valor)
}