...

/

Parameter Qualifiers: lazy, scope and shared

Parameter Qualifiers: lazy, scope and shared

In this lesson you will learn three more parameter qualifiers which are lazy, scope, and shared.

We'll cover the following...

lazy #

It is natural to expect that arguments are evaluated before entering the functions that use the arguments. For example, the function add() below is called with the return values of two other functions:

result = add(anAmount(), anotherAmount());

In order for add() to be called, first anAmount() and anotherAmount() must be called. Otherwise, the values that add() needs would not be available.

Evaluating arguments before calling a function is called eager evaluation.

However, depending on certain conditions, some parameters may not get a chance to be used in the function at all. In such cases, evaluating the arguments eagerly would be wasteful.

A classic example of this situation is a logging ...

Access this course and 1400+ top-rated courses and projects.