‫Welcome back.
‫In this video, we're going to look at enemies and an enemy is basically a set of constants.
‫It's immutable and should be placed at the namespace level so it can be used by the whole library.
‫And well, it's pretty much something like let's say we have days, so there are only seven days in
‫a week.
‫So we can create an enum called Day and it will contain a monday, it will contain a Tuesday or Wednesday,
‫Thursday, Friday, Saturday and Sunday.
‫So these are our days, and that's an enum.
‫All right.
‫That's already it.
‫So now if we want to use the day enum that we would have, it's seven values that there are and they
‫never change.
‫Right?
‫So you only have those seven days.
‫So now let's create an enum day in our main method.
‫So I'm going to create date and I'm going to call it f r setting for Friday and that will be day dot.
‫And as you can see, there are our values and they are also indexed.
‫So they thought Friday is equal to four, Monday is equal to zero.
‫All right.
‫So let's say I'm using Friday, so it starts at four.
‫It is the value of four.
‫Now let's create another day.
‫Let's say it's Sunday.
‫It's day dot, as you know.
‫Let's create another day that I'm just going to call a and a will be Friday so data FR and now let's
‫use the console right line to check if f r is equal to A, so if Friday is equal to our A day and we
‫can check that out and before we do so, we should add a console thought right key
‫like that.
‫Now let's start it again and we see it says true.
‫And that is because this day has the value of Friday and this day here as also the value of Friday.
‫We can also do something like just printing it onto the console so we can just go ahead and say something
‫like Day Dot Ammo standing for Monday.
‫Let's see what it prints onto the screen.
‫And we see it true and it says Monday, MO.
‫So Monday gave us the Monday value.
‫So it's just something like MO, but it's just a representation as a string and we can go ahead and
‫get to integer value as well.
‫So see w let's get the integer of day dot m o of Monday and as you know that zero because it starts
‫with zero.
‫So we get here true mo and zero because first value is zero, then we have one, two and so forth.
‫Now it's a little challenge.
‫Create an enum with the months of the year, so please go ahead and do that.
‫All right.
‫So we have Enum Month and we have January, February, March, April, May, June, July, August,
‫September, October, November and December.
‫So this is another month and now we can access those values in the same way.
‫And we cannot only access them in this class, but we can access them in the whole namespace because
‫I created them outside of this class and generally in that namespace.
‫Now let's say we want this to start with one, so we want Jan to be at one.
‫So let's just set the value of one and now let's write the value of our month.
‫So we're going to get month dot January or let's say we want to see if February now is actually two.
‫So I'm going to use an integer casting here.
‫So I'm going to cast that into an integer.
‫Let's see.
‫And we see February as to now, and that is because we started the index at one.
‫Now let's see if we can change as well.
‫Like July, let's say July should be now 12 because usually it would be seven the seventh month, but
‫let's say July is the 12 month.
‫So let's also print that on to the console.
‫So I'm going to use the same line of code like here, but I'm going to replace February with July or
‫actually let's say August.
‫Let's see what August gives us.
‫And we see it's 13 so we can reassign the index and it will keep on counting from that point on.
‫So you see June is equal to six, July equal to 12, August equal to 13 and so forth.
‫So generally the one thing to remember in OMS are they are to share a set of constants to keep a library
‫consistent so you can use them in all the different classes and they will always have the same value
‫and you won't have to create the constant inside of the classes all the time.