I hope you enjoyed this section and that you were able to complete this assignment based on the previous
lectures and this assignment, we wanted to create an enum called Shape and provide the values of Triangle,
Square, Pentagon and Octagon.
Then we need to create a method for this enum that returns the number of corners each shape has based
on the type of shape.
So, for example, if we have a triangle, we will return three, and then if we're square, we will
return four.
So the first thing that we need to do is create an enum called Shape, and we need to give it some variance.
So we are going to give it Triangle, Square, Pentagon to go on.
Now we need to implement our method on the Shape Enum.
And we're going to call it corners and we need to have a reference to our self.
And then we know that we want to return how many corners we have, so we're going to return an eight.
So now we are going to do a match on ourself and if we are a triangle we want to return three.
If we are a square, we want to return four, and if we are a Pentagon, we want to return five.
And then if we're an octagon.
And since that's our only other case, we can use the underscore as our catchall.
Then we want to return eight in that case.
So now we will say let shape equals shape triangle and we want to verify our results.
So we will just print them out.
So we will say shape dot corners.
And now we can run our code and we see that we have three.
So that's good.
Let's do square.
We got four.
So that's good.
So we can assume Pentagon will be fine.
So now let's check the Octagon just to verify that we get eight.
And now we have eight.
So that is my solution to the assignment.
If you have any questions, please feel free to ask them in the Q&A section.