use match statements
This commit is contained in:
parent
bfb7d95aa7
commit
0fca39e716
2 changed files with 9 additions and 24 deletions
|
|
@ -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
|
||||
);
|
||||
),
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue