Higher – SSD Functions

Still a lot of confusion over the  definition of a function and procedure in Higher Computing Science and how they differ.

A procedure is a sub program that contains a block of code. It uses parameters to pass data to and from the main program.

A function is a sub program that contains a block of code. It uses parameters to get data from the main program and passes back a single piece of data using RETURN.

In the program below you can see a procedure called calcArea and a function called funcArea. Both of these sub programs do the same thing but they way the work is different. The last two lines of code could be merged into

MsgBox(“Function Area =”  & funcArea(10,11)).

The procedure is always called on it’s own. Can you name another function shown in the program below?

 

functions

 

Leave a Reply

Your email address will not be published. Required fields are marked *