Skip to content

Instantly share code, notes, and snippets.

@jcar787
Created April 8, 2022 19:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jcar787/99cec6c0a5b52d4f9b8ebdbc4281e79c to your computer and use it in GitHub Desktop.
Save jcar787/99cec6c0a5b52d4f9b8ebdbc4281e79c to your computer and use it in GitHub Desktop.
simple functions with returns in rust
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