In this lecture I want to go over our final user defined type enemies enemies are very interesting user
defined type that I find myself using all the time you DMs are enumerated values.
So meaning they have a set range of values that they can be.
So for example we could have an enum for the four cardinal directions so we could make our Itam here
call it direction
Hebei direction type
in the four cardinal directions north
yse south
west.
So we have the keyword ENM the name of our new types.
It's called direction type.
And inside the braces we have all the values that this eadem type can have.
So namely north east south and west I usually will have all values in uppercase But this is just my
convention.
And notice also that I set the first one to be zero.
That's because each one after it will have a value of one more than the previous one.
So east here will have the value of 1 in South 2 and West 3.
We don't have to set it to zero star.
Use any number.
But again this is my convention usually set the first one to be zero.
One thing we shouldn't do is consider the values as integers outrage though often we can we should consider
them part of their own type.
K so our direction type can only have these four values and no other k.
So like I said before we could use you namaz when we need to type with only a certain number of values.
And this also helps quite a bit with readability as well.
Just like typedef Stu.
So we're using them quite a bit in the next game.
So in the next lecture I went to do some practice.