Scoping Functions

Get an introduction to the concept of scoping functions.


On the one hand, scoping functions offer the possibility of restricting the scope of variables. On the other hand, they lend a compact notation for bundling contextually related code in a clear and legible manner.

Often, we write code that first creates a new object and shortly thereafter invokes some of its methods or sets some properties.

In Java, this might look like this:

Get hands-on with 1200+ tech skills courses.