Procedural language

A procedural language is a programming language that follows instructions in a sequential manner. Consider the example below:<syntaxhighlight lang="clean" line="1"> Go to the market Buy vegetables Pay water and electricity bills Go home </syntaxhighlight>In a procedural language the above instructions will have to be done from the top to the bottom. If one instruction is not carried out the other instructions below it will not be executed.

Examples of Procedural Programming Languages[1]

  1. BASIC
  2. C
  3. Java
  4. FORTRAN
  5. PASCAL

The above languages listed above are considered procedural because of the manner in which they execute when they are run. Consider one example in C programming:<syntaxhighlight lang="c" line="1">

  1. include <stdio.h>

int main() {

   int num1 = 5;
   int num2 = 10;
   
   int sum = num1 + num2;
   
   printf("%d + %d = %d", num1, num2, sum);
   
   return (0);

}

/* Output */ // 5 + 10 = 15 </syntaxhighlight>As we can see the execution goes from top to bottom. In the event that one instruction is wrong the execution is halted and an error occurs in procedural languages if the error isn't handled.

Advantages

  1. It makes learning of programming languages very easy.
  2. Writing simple programs, testing them and debugging them is very easy when written in procedural manner.
  3. They are well structured which makes readers easily understand what a program is doing.

Disadvantages

  1. Code reuse is not possible. Which bring us to point number 2
  2. Raises development costs due to the inability to reuse code
  3. Testing is difficult especially when the project gets bigger and bigger.

Considering the above pros and cons [2] is important as you develop projects.

References

  1. "What is a Procedural Language?". www.computerhope.com. Retrieved 2021-10-27.
  2. "What is Procedural Language and Non-Procedural Language". T4Tutorials.como. Retrieved 2021-10-27.