- programming.dojo.net.nz
- Languages
- Codex
- Study
- Resources

An imperative programming language is one that does things a step at a time, typically manipulating the state of the program in some way at each step. Basic is a good example of an imperative language:

```
FUNCTION prime% (n!)
IF n = 2 THEN prime = 1
IF n <= 1 OR n MOD 2 = 0 THEN prime = 0
FOR a = 3 TO INT(SQR(n)) STEP 2
IF n MOD a = 0 THEN prime = 0
NEXT a
prime = 1
END FUNCTION
```

In this example, we perform each line in sequence until there are no more steps to peform (i.e. we reach `END FUNCTION`

).