Skip to content

cotrEnum

Creates an enum

Aliases:

  • cotrEnum
  • enum

cpp

enum class MyEnum {
value1,
value2,
// Add more values here
};

csharp

enum MyEnum {
value1,
value2,
// Add more values here
}

dart

enum MyEnum {
value1,
value2,
// Add more values here
}

go

const (
variable1 = iota
variable2
variable3
// Add more variables here
)

java

enum MyEnum {
value1,
value2,
// Add more values here
}

kotlin

enum class MyEnum {
value1,
value2,
// Add more values here
}

perl

# Perl does not have a built-in enum type. Use a list or hash instead.

php

abstract class MyEnum {
const VALUE1 = 0;
const VALUE2 = 1;
// Add more values here
}

python

class MyEnum(Enum):
value1 = 1
value2 = 2
# Add more values here

r

# R does not have a built-in enum type. Use a list or vector instead.

ruby

MyEnum = [:value1, :value2]
# Access: MyEnum[0] # :value1

rust

enum MyEnum {
Variant1,
Variant2,
// Add more variants here
}

swift

enum MyEnum {
value1,
value2,
// Add more values here
}

typescript

enum MyEnum {
value1,
value2,
// Add more values here
}

typescriptreact

enum MyEnum {
value1,
value2,
// Add more values here
}