Created
April 8, 2022 19:35
-
-
Save jcar787/99cec6c0a5b52d4f9b8ebdbc4281e79c to your computer and use it in GitHub Desktop.
simple functions with returns in rust
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fn another_sum(x: i32, y:i32) -> i32 { | |
x + y | |
} | |
fn sum(x:i32, y:i32) -> i32 { | |
return x + y; | |
} | |
fn main() { | |
println!("{}", sum(5, 8)); | |
println!("{}", another_sum(9, 12)); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment