DEV Community

Cover image for Keywords in Kotlin
Jay Tillu😎
Jay Tillu😎

Posted on • Updated on

Keywords in Kotlin

  • Keywords are predefined, reserved words that have special meaning in the language.

  • Generally, it is recommended to do not use it as identifiers.

  • But in kotlin, there are some keywords which can be used as identifiers in some situations.

  • There are basically four types of keywords in kotlin:

  • Hard keywords

  • Soft keywords

  • Modifier keyword

  • Special identifiers

Hard Keywords


  • There are 24 hard keywords in kotlin which cannot be used as identifiers in any situation.

  • Below is the list of hard keywords.

Soft Keywords


  • There are 17 soft keywords in kotlin.

  • These tokens act as a keyword in a certain context, but you can use them as identifiers in another context.

  • Below is a list of soft keywords.

Modifier Keywords


  • There are 29 modifier keywords in kotlin.

  • These tokens act as keywords in modifier lists of declaration and can be used as identifiers in another context.

  • Below is a list of modifier keywords.

Special Identifier


  • Following two special identifiers are defined by the compiler in a specific context and can be used as regular identifiers in another context.
  • Below is a list of those two identifiers.

Please, Guys, avoid them to use as identifiers. It's my best suggestion to you in just one word. Avoid Keywords as Identifiers.

So, guys, that’s it for keywords. Feel free to ask for any queries.

Till then Keep Coding, Keep Loving.

Jai Hind, Vande Mataram 🇮🇳

Wanna get in touch with me? Here are links. I’ll love to become your friend. 😊

Latest comments (0)