DEV Community

Discussion on: Functional programming basics part 1: Pure function

 
ycmjason profile image
YCM Jason

@tuxOr

There is nothing to do with the signature of a function.

A function is pure if and only if

  1. The returned value is calculated only with the arguments
  2. It does not change any thing outside of a function (side effect)

So in your example, assuming process(var1, var2) will make some side effect somewhere else in the program, it is not a pure function.

However, if process do not make any changes, then it will still be a pure function.

Thread Thread
 
tux0r profile image
tux0r

I think I understood now, thank you!