Imperative programming

Updated: 09/12/2023 by Computer Hope
imperative programming

Imperative programming is a paradigm of computer programming where the program describes steps that change the state of the computer. Unlike declarative programming, which describes "what" a program should accomplish, imperative programming explicitly tells the computer "how" to accomplish it. Programs written this way often compile to binary executables that run more efficiently since all CPU (central processing unit) instructions are imperative statements.

To make programs simpler for a human to read and write, imperative statements can be grouped into sections known as code blocks. In the 1950s, the idea of grouping a program's code into blocks was first implemented in the ALGOL (algorithmic language) programming language. They were originally called "compound statements," but today, these blocks of code are known as procedures. Once a procedure is defined, it can be used as a single imperative statement, abstracting the control flow of a program. The process allows the developer to express programming ideas more naturally. This type of imperative programming is called procedural programming, and it is a step towards higher-level abstractions such as declarative programming.

Imperative programming languages

Declarative programming, Language, Paradigm, Procedural language, Programming language, Programming terms