Show Buttons
Share On Facebook
Share On Twitter
Share On Google Plus
Share On Linkdin
Share On Reddit
Share On Stumbleupon
Contact us
Hide Buttons

imperative vs declarative/functional programming

Imperative Programming :

It specifies a series of instructions that the computer executes in sequence. For example, the following function uses imperative approach for finding the square of each element in the given array.


Declarative Programming :

It declares a set of rules about what outputs should result from which inputs. For example, the following function uses declarative approach for finding the square of each element in the given array.


Functional Programming :

It declares a set of logical functions which define how input is transformed to output. eg. f(y) = y * y. It is a type of declarative language.