Skip to content

Instantly share code, notes, and snippets.

@dlecan dlecan/main.rs
Created Jul 11, 2016

Embed
What would you like to do?
fn calculer_division(x: i32, y: i32) -> i32 {
match y {
0 => panic!("Division par 0"),
1 => x,
_ => x / y
}
}
fn main() {
let resultat = calculer_division(-4, 2);
println!("Résultat : {}", resultat);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.