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

Imper­a­tive Programming :

It spec­i­fies a series of instruc­tions that the com­puter exe­cutes in sequence. For exam­ple, the fol­low­ing func­tion uses imper­a­tive approach for find­ing the square of each ele­ment in the given array.


Declar­a­tive Programming :

It declares a set of rules about what out­puts should result from which inputs. For exam­ple, the fol­low­ing func­tion uses declar­a­tive approach for find­ing the square of each ele­ment in the given array.


Func­tional Programming :

It declares a set of log­i­cal func­tions which define how input is trans­formed to out­put. eg. f(y) = y * y. It is a type of declar­a­tive language.