what is the standard for enums and static vars, re...
# codingconventions
s
what is the standard for enums and static vars, regarding casing. In java it is DARK_CHOCOLATE vs darkChocolate for example
l
Personally, I don't like SCREAMING_SNAKE_CASE. I prefer
PascalCased
TopLevelVariables
or
Constants
in general
I think the official reference is this
m
Kotlin docs for enum show examples in screaming case, but indeed at the end of the above linked section we can read:
For enum constants, it’s OK to use either uppercase underscore-separated names (screaming snake case) (
enum class Color { RED, GREEN }
) or upper camel case names, depending on the usage.
I’ve found the second convention used a lot in various codebases, and actually prefer it. Moreover it’s consistent with the
object
naming convention, makes sense to me.