A programming paradigm is the structure and approach of a programming language. Put simply, this is a style or a way of programming, sometimes referred to as a way of thinking about computing and how to organise programming tasks.
Popular programming paradigms include imperative, procedural and Object Orientated Programming (OOP).
Imperative programming
imperative languagesProgramming paradigm that consists of commands for the computer to perform use statementThe smallest element of a programming language which expresses an action to be carried out. to change the state of the program. A program's state is the current values of its variableA memory location within a computer program where values are stored. at any given moment. Programs written using an imperative language make use of assignmentSetting the value of a variable in a computer program. to change the state of their variables.
In the example below, the value 7 is assigned to variable a, the value 14 assigned to variable b, and the sum of variables a and b assigned to variable c. A program designed to output the value of c, and the value of c when the value of variable a is increased by 1 will look like this: