loading...
Cover image for Keywords in Kotlin

Keywords in Kotlin

jay_tillu profile image Jay Tillu😎 ・2 min read
  • 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.

Wanna get in touch with me? Here are links. I’ll love to become your friend. 😊
Twitter
Facebook
Instagram
Medium
or just mail me at jayviveki13@gmail.com

Posted on by:

jay_tillu profile

Jay Tillu😎

@jay_tillu

🌏 विधायास्य धमॅस्य संरक्षणम् 🌍 ☀️ Society before Self ☀️ 🙏🏻 Humanism by Religion 🙏🏻 💻 Work for Mankind 💻 🌐 Believes in वसुधैव कुटुम्बकम् 🌐

Discussion

pic
Editor guide