7 ms·
Imperative programs work in steps. It will be like, "Do this, then do this, then do this" etc, etc. Functional programming does not have 'steps'. A functional p
by imakesnowflakes 11y ago
Imperative programs work in steps. It will be like, "Do this, then do this, then do this" etc, etc. Functional programming does not have 'steps'. A functional program is a series of definitions like, A IS B, B IS C and C IS D.
Running an imperative program comprise of setting up some initial state of all the variables and executing the steps in it, after which the state of all variables contain the result.
Running a functional program comprise of taking the input value, and following through the definitions and the end, you will have the result.
The difference between the two is that with imperative programs, there is a dependency on the state at every step. This makes it harder to write complex imperative programs. Functional programs does not have any steps, and hence no 'states' and hence eliminates this overhead...