use match statements

This commit is contained in:
raf 2024-12-01 18:06:40 +03:00
commit 0fca39e716
Signed by: NotAShelf
GPG key ID: AF26552424E53993
2 changed files with 9 additions and 24 deletions

View file

@ -13,16 +13,14 @@ fn main() {
let test_point = read_point("Enter the coordinates for the point to test (x y):");
// Finally, check if the point is inside the triangle.
// TODO: make this a match
if triangle.contains_point(&test_point) {
println!(
match triangle.contains_point(&test_point) {
true => println!(
"The point ({}, {}) lies inside the triangle.",
test_point.x, test_point.y
);
} else {
println!(
),
false => println!(
"The point ({}, {}) lies outside the triangle.",
test_point.x, test_point.y
);
),
}
}