Groovy uses all the keywords from the Java language and also has some additional keywords added specifically to the Groovy language. We will go through the list of keywords in Groovy. Keywords are reserved words in a programming language that have specific meaning or its own purposes and should not be used for other purposes (like variable names, method names, etc) than what it is meant for.
Reserved Groovy Keywords:
- abstract
- assert
- break
- case
- catch
- class
- continue
- def
- default
- do
- else
- enum
- extends
- final
- finally
- for
- if
- implements
- import
- instanceof
- interface
- native
- new
- null
- non-sealed
- package
- public
- protected
- private
- return
- static
- super
- switch
- synchronized
- this
- throw
- throws
- transient
- try
- while
Contextual Groovy Keywords:
- as
- in
- permits
- record
- sealed
- trait
- var
- yields
Contextual keywords are keywords that are used only under certain context and can be used in variable names, function names etc.