What is functional programming? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

What is functional programming?

I was roaming around Q/A forum and there is see a question about c as functional programming. I googled it also.,but i cant get the point . So, can anyone please explain me about the *functional programming* in a easy language.

19th Aug 2019, 10:34 AM
Monkey D. Luffy
Monkey D. Luffy - avatar
7 Answers
+ 4
Seb TheS First... I want to commend your attempt to explain the differences between pure and impure functions. However, it's a bit off point and not entirely accurate. That's not completely uncommon for this type of question. The subtleties aren't always easy to grasp upon initial review. Take a look at the thread posted here by ✳AsterisK✳ ... It's become a solid resource for understanding this. 😉👌
20th Aug 2019, 2:30 AM
David Carroll
David Carroll - avatar
20th Aug 2019, 1:08 AM
✳AsterisK✳
✳AsterisK✳ - avatar
+ 2
David Carroll shared some links on the thread, read from it and you will have great understanding of what it is
20th Aug 2019, 1:00 AM
✳AsterisK✳
✳AsterisK✳ - avatar
+ 2
✳AsterisK✳ Will you please share the link to me
20th Aug 2019, 1:02 AM
Monkey D. Luffy
Monkey D. Luffy - avatar
+ 2
i am unable to find that
20th Aug 2019, 1:04 AM
Monkey D. Luffy
Monkey D. Luffy - avatar
+ 1
It is a style of programming. One of it's principles is to avoid using inpure functions, because it can reduce the readability of the code. An example: You want to change variable b with a function: int b = 7; The inpure function way to do this is to change it from a function: void f1() {b = 9;} f1(); b is now 9. If you were reading the code, you might not have noticed b's value has changed. Pure functions way to do it, is to change b's value with the return value: int f2() {return 11;} b = f2(); b is now 11. When you read the code, b = f2() might give a message, that b's value can be somehow important. And f2 would have something to do with the variable b.
19th Aug 2019, 1:18 PM
Seb TheS
Seb TheS - avatar
+ 1
they're more than one, just scroll down through the thread
20th Aug 2019, 1:03 AM
✳AsterisK✳
✳AsterisK✳ - avatar