+ 1
The difference between pure and impure function?
I am not really understand clearly about the difference between pure and impure function. Anyone can help me explain that? Thanks.
2 odpowiedzi
+ 2
There are two aspects of purity. First you use no variable that you do not pass as an argument. Secondly, you do nothing but return a result, no printing to the screen, no setting of variables.
0
An impure function CHANGES the state of the program while a pure function always compute the same outcome when you give it the same arguments. A pure function never changes the state of the program