Created
July 11, 2016 21:21
-
-
Save dlecan/9377cc795ecfef5f2d613b70d0c6c292 to your computer and use it in GitHub Desktop.
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 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