Sun. Jan 22nd, 2023

Procedural Programming – Structure

Procedural programming is a design paradigm – a style. You will also study Event Driven and Object Oriented paradigms, but understand that the principles of procedural programming also apply in those instances.

Procedural programming underpins the fundamental basics of programming. It is defined as code that makes use of:

  • statements
  • blocks
  • procedures
  • functions

As stated above, these are fundamentals that also apply to all other programming paradigms.

Statements

The most basic part of a computer program is a statement. It is a single instruction, that performs a specific, small task.

For example the following is a statement:

C#
int score = 0;


Python 
score = 0

In either case, the purpose of the statement is to declare that there will be a variable called ‘score’, that it is going to store a numeric value, and that the value will be initialised to ‘0’.

Blocks

A block of code is a collection of individual statements that are intended to be grouped together; this is, when one of the lines executes, then the others are also expected to follow.

Procedures

A named block of code, which may or may not require arguments to be supplied is called a procedure. A procedure processes data, but does not return a value to the code from where it was called.

Functions

A named block of code, which may or may not require arguments to be supplied, but that does return a value upon completion, is called a function.