What is pure function? Please give one example also | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

What is pure function? Please give one example also

I didn't understand concept of being pure or impure

15th Mar 2017, 1:47 AM
Prashant Singh
Prashant Singh - avatar
1 Answer
+ 1
A pure function only affects its input and output parameters. A non-pure function affects other objects outside its scope. This can also be known as a function having side-effects.
15th Mar 2017, 6:55 AM
Álvaro