Welcome back.
Welcome to the section on Functional Programming.
Now, if you ask me what is the biggest difference between functional programming and object-oriented
programming, then the thing which stands out is that in functional programming, functions are first class
citizens.
What do I mean by first class citizen?
Let's look at an example in here, right? So,
student is a object.
The object, I am able to store it in a variable, I am able to invoke methods on the variable, and we can
pass the object as data to a method.
Now, think about a function or a method. Will I be able to pass function as the parameter to a method?
Will I be able to get function as a return value from a method?
Can I assign a function to a variable?
Nope. Until now, in whatever we have discussed, we store objects in a variable, we send objects as parameters,
and we get objects as return values. But for functions, we will not be able to do that.
And that's where functional programming comes in. Functional programming comes in and says, try and give
first class status to functions.
Now, you might be asking how do we do that?
That's basically what we would try and do in the next few steps. Trying to create variables with functions,
trying to pass functions to functions, and having return values as functions brings in a complete different
thought process.
And as a beginner, it might be a little difficult and tricky to understand all these.
So, what I'll do is, we'll keep it very simple, we'll try and go one step at a time with very simple examples,
and try and introduce you to the wide range of concepts that are related to functional programming.
Welcome to this section.
I'll see you in the next step.
Until then, bye-bye.