So in this lesson we're going to talk about enumerations or what we call EON's you know is that essentially
a way of time close sooner or related values with each other.
So it becomes what we call a typesafe what it means is it means you have values such as south east north
and west and you put all of them inside one value called let's say direction and then we can get direction
dot south and direction that North.
And the reason it is safe is simply because we have to use the dot operation because of that is constrained.
We cannot accidentally right a wrong value in there.
So we don't mind this go ahead and get started in ex-coach and see how you're going to do this.
When I go to explore I start a new project let's call it informs us with might you know I'm safe I'm
going to go ahead and say get rid of all of that as usual.
So if you remember earlier on in some of our previous lessons we're talking about a an application that
essentially is a real estate listing application and we said some of the listings are for sale.
Some of them are for rent.
So here is a vivid example of how to use enormous here.
I'm going to say you know let's call it the property type and it has two cases case sale and case are
right.
So I have two types.
One of them is for sale.
One of them is for rent.
Now let's see how we're going to use that.
And why go ahead and say class and my classes property doesn't have a superclass.
And yet I have a variable let's say address which is a string.
And I have a variable type Ritchies proper type.
And of course if I try to initialize this I have to say in its e-mail address which is a string as all
dates and type which is proc type and of course self that address becomes empowered dress and self that
type certainly becomes proper type or type site type.
So simple as that.
So every time we are making a property our right off the bat based on a kind of strange enough we can
choose which one of these two conditions is that.
So here again go ahead and say where this property is going to be a property that property is going
to be an actress.
Let's say take the street and then the input type is going to be propped type Perabo type dot Brant
for instance.
So I know this one is for rent.
And now if you want to use this I could go ahead and say for instance if this was a member of an array
and you were running a search now you can do all of those things yourself.
I could say if this property dot product type is Propp type dot say it for instance then let's say display
this or whatever that you think you want to be doing with it.
So that's essentially the core concept of enumeration or enough times.
So before I finished this lesson there is one more kind of Islam that I want to show you one that's
enumeration Veit case.
I tried to state.
So here's how we do those.
I'm going to go ahead and say you know I mean all our cities and it is.
CHACE I treatable.
And then the cases are Vancouver Sun from New York.
And then I'm going to go ahead and say for let's call it city in cities all cases of Prince city for
me.
And that's about that.
I can iterate through the objects in my cities through the chases in my enumeration.
So as you mention very useful info and values are related to each other and you want them to be typesafe.
So you know specifically which one you're choosing you're choosing property type data sale and you can
obviously use those for a variety of purposes would end up seeing this happening more and more as we
go through real applications.
So our eyes should see you guys in the next lesson I guess.