Can anyone tell me in what situations can I use enumerated data type? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Can anyone tell me in what situations can I use enumerated data type?

I would like to know some ways in which I can use enumerated data type. Some applications sort of.

28th Dec 2016, 5:04 AM
Shannon Vaz
Shannon Vaz - avatar
1 Answer
0
If you have a limited set of options and don't want data to overflow these options. For example, in a personal project I have the following options: Add, Edit or Status. I could store them a lot of ways, but by using enums, I'm sure the input will always be one of these. There's no way a user will input something like Delete, because it is not enumerated and won't be even considered other than an error.
29th Dec 2016, 3:52 AM
Leon Nascimento
Leon Nascimento - avatar