English

What is the side effect of the impure function? Give example.

Advertisements

Question

What is the side effect of the impure function? Give example.

Short/Brief Note
Advertisements

Solution

Impure Function:

  • The return value of the impure functions does not solely depend on its arguments passed. Hence, if you call the impure functions with the same set of arguments, you might get different return values. For example, random( ), Date( ).
  • They may modify the arguments which are passed to them.
shaalaa.com
Pure Functions
  Is there an error in this question or solution?
Chapter 1: Function - Evaluation [Page 9]
Advertisements
Share
Notifications



      Forgot password?
Use app×