2 Réponses
+ 3
A pure function is like a "mathematical" function, i.e. given some arguments it will always produce the exact same result, regardless of global state. It will do no I/O, no network communication, no other effect apart from returning a value. This also includes not messing with parameters passed by reference (or pointer).
Non-pure - all the rest. E.g. logging something, writing to a file, basically anything visible from the outside, apart from the return value.
+ 3
Pure function means that your function only uses the values you pass as arguments and only gives back the return value but doesn't change anything else outside of the function. This makes it easier to find bugs.