= Imperative programming
{wiki}
<Imperative programming> describes computation through commands changing program state. Assignment updates a variable, sequencing orders commands and loops repeat updates until a condition changes. To sum a list, an imperative program can maintain an accumulator and add each next element into it. Correctness can be expressed through a <loop invariant>: after processing a prefix, the accumulator equals that prefix's sum. State changes can be local or observable as a <side effect>. The paradigm concerns the description of computation, rather than requiring a particular processor architecture.
Back to article page