+ 3

What is a practical use of an enum?

can any one tell me what situations an enum might be used for?

12th Oct 2018, 4:32 PM
Steven Trippier
Steven Trippier - avatar
5 Antworten
+ 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
12th Oct 2018, 5:57 PM
Steven Trippier
Steven Trippier - avatar
15th May 2020, 11:24 AM
Shahghasi Adil
Shahghasi Adil - avatar
+ 1
For example the result status from your application enum Status { OK, NOT_OK, ERROR }
12th Oct 2018, 5:43 PM
Chriptus13
Chriptus13 - avatar
0
Keeping track of which direction a cubes' face points: Enum Direction{north, south, east, west, top, bottom}
8th Dec 2018, 9:06 PM
William Ashe
William Ashe - avatar
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
24th Feb 2019, 9:17 PM
Tomás Atrat