Nepedia
Back to Discover
Fluent Reader
💻

Imperative programming

technology Maturity 7-9 Next article →

Computers need clear instructions to do anything useful. One way to give these instructions is through imperative programming. This style uses commands to change the state of a process. You can think of the state as the current information held in the computer's memory.

Computer-memory-map
Computer-memory-map

In this way of working, the programmer describes exactly how a program operates step by step. This is different from declarative programming, which only describes the final result. Most computer hardware is designed to run this kind of imperative code. It is a very common way to build software today.

To make a program work, the computer follows specific tools. One tool is the assignment statement. This tells the computer to perform an operation and store the result in memory.

Computer-memory-map
Computer-memory-map

Another tool is the loop. A loop lets the computer repeat a sequence of steps many times. Sometimes it repeats a set number of times. Other times it repeats until a certain condition is met. There are also conditional branching statements. These allow the computer to skip certain steps unless a specific condition is true.

Computer-memory-map
Computer-memory-map

People have been developing these languages for a long time. In 1954, John Backus at IBM began working on Fortran. It was the first major language to help people write complex programs easily. Later, in the 1960s, experts created ALGOL to help express math ideas. In 1960, COBOL was developed to look more like English. Grace Hopper was a major contributor to COBOL's development. In the 1970s, Dennis Ritchie created the C language at Bell Laboratories.

Computer-memory-map
Computer-memory-map

These early steps helped shape how all modern computers work.

Many different types of imperative languages exist with unique features. Fortran was built for scientific calculations and math. COBOL was designed so that managers could read the code. BASIC was created at Dartmouth College in 1964 to help students learn.

Computer-memory-map
Computer-memory-map

In the 1970s, Niklaus Wirth developed Pascal. The United States Department of Defense also used a language called Ada. This language was designed by Jean Ichbiah and a team at Honeywell. They began the project in 1978 and published the rules in 1983. Each of these languages helped solve different problems for different people.

Imperative programming is a lot like following a recipe in a kitchen. Each instruction tells you exactly what to do next. If the recipe says "add salt," you are changing the state of the food.

Computer-memory-map
Computer-memory-map

A checklist is another great example of this style. You follow one task after another to finish a job. Even though computer code looks very different, it follows this same simple logic. It moves from one step to the next in a specific order. This makes it a very natural way for humans to talk to machines.

453 words

Where will your curiosity go next?

Keep exploring at your chosen reading level.

🖼️ Images & Media (1)
File:Computer-memory-map.png
Computer-memory-map.png
More to explore

What is Nepedia?

A free, ad-free encyclopedia for children. Every article is written at five reading levels, so the same page works for a five-year-old and a fifteen-year-old — use the level switcher above to see this one change. No account needed to read.