Pure &Impure functions | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Pure &Impure functions

Hey, i didn't really understand what's the differents between pure and impure functions. can anyone help?

30th Jun 2018, 11:36 PM
Guy Redid
Guy Redid - avatar
2 Answers
+ 3
Pure functions do not change state Whereas impure functions change state https://www.sololearn.com/learn/JUMP_LINK__&&__Python__&&__JUMP_LINK/2459/
30th Jun 2018, 11:44 PM
Agent
Agent - avatar
0
An impure function mutates variables/state/data outside of it’s lexical scope. Pure functions don’t modify external variables/state/data outside of the scope, and returns the same output given the same input.
1st Jul 2018, 12:28 AM
Afif_
Afif_ - avatar