I need make an objet (client) with this variables:
- Name
- Date
- Age
- Phone
- Type
But Type
can only take 3 values: Good
, Fair
, Poor
.
How you declare the variable type
?
I need make an objet (client) with this variables:
But Type
can only take 3 values: Good
, Fair
, Poor
.
How you declare the variable type
?
You can define it as an enum to restrict the possible values to a small set:
enum Type {
Good,
Fair,
Poor
}
And see this answer for more background.