Essay about Procedural Programming : Functions And Functions

797 Words Nov 9th, 2014 4 Pages
Procedural programming –Assignment 1

Contents
Introduction 1
Procedures 1
Functions and pre-defined functions 2
Local variables and global variables 2
Parameter passing 3
Programming libraries 5
Modularity 5
Bibliography 8

Introduction
Procedural programming is a method used by programmers for writing a computer program by defining each step of the coding that is used. This report will focus on and explain all the main features that a procedural program consists of. These will include; Procedures, Functions and Pre-defined functions, Local and Global variables, Parameter passing, Programming libraries, Modularity and Control structures.

Procedures
A procedure is a part of the program, which refers to a set of statements or instructions that are laid out in a certain order and perform a particular task. A procedure can be initiated at any time in the program.

Below is an example of a procedure that aims to store a name in a variable:

Functions and pre-defined functions
A function is similar to a procedure but the difference is that a function outputs a result or value after performing its task whereas a procedure does not output any value. A function always starts with the ‘def’ (define) statement and can be initiated at any time in the program like a procedure.

Below is an example of a function that is being defined. (Fibonacci function):

A pre-defined function is a function that is already built in the program. Such as ‘print’.

Local variables and global…

Related Documents