Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What are the Reserved Keywords in Kotlin?

Tags:

kotlin

I've walked through https://kotlinlang.org/docs/reference but I could not find reserved keyword, used in Kotlin. How many keywords does Kotlin have? As long as we know Java has its own keyword list like here: enter image description here

like image 933
borrom Avatar asked Jan 15 '16 03:01

borrom


2 Answers

UPD: The keyword reference was added to the Kotlin docs: (here)


An auto-generated list of hard keywords for the current version can be found in Kotlin Github repo: (here)

There are more soft keywords, which behave like keywords in certain context, like it, field, object, access & member modifiers.

More about context in which soft keywords are treated as keywords can be found in the grammar reference, along with the whole grammar, including hard keywords in their places.

like image 110
hotkey Avatar answered Nov 18 '22 15:11

hotkey


There is a grammar reference https://kotlinlang.org/docs/reference/grammar.html

So anything in double quotes is a keyword (like "class") or an operator (like "%"). However many keywords are "soft" (like "file"), meaning that they depend on their syntactic position and still may be used as function names, etc.

like image 5
voddan Avatar answered Nov 18 '22 15:11

voddan