Say, I need to add two matrices. And, I want to solve this problem in the imperative paradigm.
From (1) know that
The canonical examples of imperative programming languages are Fortran and Algol. Others include Pascal, C, and Ada.
From (2), I see the following source code:
result = []
i = 0
start:
numPeople = length(people)
if i >= numPeople goto finished
p = people[i]
nameLength = length(p.name)
if nameLength <= 5 goto nextOne
upperName = toUpper(p.name)
addToList(result, upperName)
nextOne:
i = i + 1
goto start
finished:
return sort(result)
Looking at the above code, my personal assumption is that Pascal, C, and Ada are not purely imperative languages. They are mainly structured languages that support imperative coding.
When I check the source code of FORTRAN 77, it seems to me that this is not much different than that of C. So, I am confused.
Which programming language can I use to achieve this?
Is Assembly Language imperative?
There’s no such thing as a “purely imperative language”. It’s not clear what that would even mean. Even assembly language includes addressing modes that are arguably function evaluation. When people talk about “imperative programming” they are contrasting with programming that is explicitly non-imperative, like pure functional programming. Virtually all programming that is done, including virtually all “procedural” and “object-oriented” programming, is imperative.