Is imperative programming the same as procedural programming? | Sololearn: Learn to code for FREE!
Novo curso! Todo programador deveria aprender IA generativa!
Experimente uma aula grƔtis
+ 4

Is imperative programming the same as procedural programming?

Or is procedural just a subset of imperative?

16th Jun 2019, 12:49 AM
Sonic
Sonic - avatar
3 Respostas
+ 7
Sonic Imperative programming focuses on control flow and state with the explicit use of statements and operations. Statements can include assignment statements, looping statements, conditional statements, branching statements, etc. Operations include arithmetic, relational, bitwise, logical, assignment and other capabilities. Procedural programming is a subset of imperative programming emphasizing a concept known as procedures (a.k.a. routines, subroutines, functions). These procedures contain imperative statements which are isolated within a separate scope and can be called using a declared name. The alternative to procedure calls would involve goto statements and jump tables.
16th Jun 2019, 2:36 AM
David Carroll
David Carroll - avatar
+ 13
Procedural programmingĀ is a type ofĀ imperative programmingĀ in which theĀ programĀ is built from one or more procedures (also termed subroutines or functions). ... The concepts behind object-orientedĀ programmingĀ attempt to extend this approach.Ā Procedural programmingĀ could be considered a step towards declarativeprogramming.
16th Jun 2019, 12:56 AM
AssassinšŸ’ž[#BeFierce]
AssassinšŸ’ž[#BeFierce] - avatar
+ 3
Assassin Your response is generally correct except for the last part stating that "procedural programming could be considered a step towards declarative programming." This is presented in the context that OOP extends the concepts of subroutines or functions in procedural programming (PP). I don't believe the existence is OOP makes PP less imperative or more declarative.
16th Jun 2019, 2:29 AM
David Carroll
David Carroll - avatar