+ 3
What is a practical use of an enum?
can any one tell me what situations an enum might be used for?
5 Respuestas
+ 6
thanks I had a little Google in the mean time seems you can also use them for switch statements :) I'll do some further digging
+ 1
For example the result status from your application
enum Status {
OK, NOT_OK, ERROR
}
0
Keeping track of which direction a cubes' face points:
Enum Direction{north, south, east, west, top, bottom}
0
Imagine you have an application with three characters with different names and different actions. You may create an enum of names and then you may declarate a switch with the specific action for each character