https://luascripts.com/lua-enum
function Enum(...)
local enum = {}
for index, value in ipairs({...}) do
enum[value] = index
end
return enum
end
Status = Enum("Pending", "Active", "Completed")
from enum import Enum
class Color(Enum):
RED = 1
GREEN = 2
BLUE = 3
# Accessing enum members
print(Color.RED)
print(Color.GREEN.name)
print(Color.BLUE.value)
# Iterating over enum members
for color in Color:
print(color)
https://www.geeksforgeeks.org/enumeration-enum-c/
#include <stdio.h>
// Defining enum
enum direction {
EAST, NORTH, WEST, SOUTH
};
int main() {
// Creating enum variable
enum direction dir = NORTH;
printf("%d\n", dir);
// This is valid too
dir = 3;
printf("%d", dir);
return 0;
}