scope

Kotlin supports following scopes:

  • package scope - everything that declared inside package
  • modules scope - everything that declared inside module
  • class scope - everyhing that declared within class/object/interface body
  • local scope - everything that declared within function or method body
  • block scope - anything declared within the curly brackets {} or the Kotlin statement/expression body
  • the top level scopes of non-script Kotlin files

modules

A Kotlin module is a set of Kotlin files which are considered to be interdependent and must be handled together during compilation. In a simple case, a module is a set of files compiled at the same time in a given project:

  • a Maven module
  • a Gradle project