How can we differentiate pure and normal function? | Sololearn: Learn to code for FREE!
Nouvelle formation ! Tous les codeurs devraient apprendre l'IA générative !
Essayez une leçon gratuite
+ 1

How can we differentiate pure and normal function?

1st May 2019, 2:16 AM
chandrika
chandrika - avatar
2 Réponses
+ 3
We can have pure void functions but only pretty silly ones. There are two in total: void do_nothing() { } void crash() { while(true) { } }
1st May 2019, 9:35 AM
Schindlabua
Schindlabua - avatar
+ 2
Pure function has not side effects.pure functions return value depend on given parameters and memory. And important thing is pure functions have strong return type..it can't have return type like "void".
1st May 2019, 2:30 AM
Jaliya Roshen
Jaliya Roshen - avatar