Named constants within function

While we would not normally call that constants (not in Java either) the code is equivalent. The term constant is normally for something that always has the same value (not different per invocation/instantiation). In Kotlin that means you would define the constant in the companion object.