Select a Paradigm
→
Imperative
Step-by-step commands that mutate state
Imperative programming describes computation as a sequence of statements that change program state. The programmer specifies exactly how the machine should achieve a result by issuing ordered instructions, much like a recipe. Variables hold mutable state, and control flow (loops, conditionals) determines the execution path. It is the closest paradigm to how hardware actually operates.
Key Ideas
1Explicit sequences of commands executed in order
2Mutable variables whose values change over time
3Control flow via loops, conditionals, and jumps
4Direct correspondence to the Von Neumann architecture
Strengths
- ✦Maps directly to hardware execution model
- ✦Fine-grained control over performance and memory
- ✦Easy to trace and debug step by step
Weaknesses
- △Mutable state makes reasoning about correctness harder
- △Code can become tangled as programs grow
- △Difficult to parallelize safely
Used in:Low-level systems code, embedded firmware, scripting, game loops
Imperative Quiz
Imperative Quiz
QUIZ 1/8What is the core mechanism of imperative programming?
Practice Exercises
Classify each paradigm into the correct family: Imperative Family or Declarative Family.
EXERCISE 1/2Procedural
Object-Oriented
Functional
Logic
Imperative Family
Declarative Family
Match each language to the paradigm it is most strongly associated with.
EXERCISE 2/2Java
Haskell
C
Prolog
SQL
Object-Oriented
Functional
Procedural
Logic
Declarative