Each block defines a new scope, such as a class, method or statement. Scopes may be nested inside of one another, and they are static. Scope lifetime is dynamic during runtime.

Local variable

Methods can define their own local variables:

  • Short lived, like parameters.
  • Method sets their values.
  • Used for temporary calculation and storage.
  • Exist only as long as the method is being executed.
  • Only accessible from within the method.
  • Only defined within a particular scope.
Link to original