Professional Documents
Culture Documents
fib 0 = 1
fib 1 = 1
fib (n + 2) = fib (n + 1) + fib n
sub n
| n < 10 = 0
| n > 100 = 2
| otherwise = 1
square x = x * x
◦ Imperative Languages:
◦ Efficient execution
◦ Complex semantics
◦ Complex syntax
◦ Concurrency is programmer designed
◦ Functional Languages:
◦ Simple semantics
◦ Simple syntax
◦ Inefficient execution
◦ Programs can automatically be made concurrent
Any Imperative Programming (IP) Languages can contain the following Characteristics:
Sequence of Statements.
Order of execution of Statements is very important.
Stateful Programming Model.
They contain state.(In information technology and computer science, a program
is described as stateful if it is designed to remember preceding events or user
interactions; the remembered information is called the state of the system.)
They use both Immutable and Mutable Data.
They can change state. They directly change the state of Program.
They may have Side-effects.
They represent state with Data Fields.
Main Focus on: “What you are doing” Main focus on “How you are doing”
Order of execution is less importance. Order of execution is must and very important.