Constants

A val property is immutable, but it is not a constant in Kotlin.

If that sounds confusing… that is not surprising.

Declaring a Constant

A constant is declared by adding the const keyword before val:

const val REQUEST_PERMISSIONS = 1337

And… that’s it.


Prev Table of Contents Next

This book is licensed under the Creative Commons Attribution-ShareAlike 4.0 International license.