Procedures and functions

what is difference between procedures and functions please explain deeply, i would like to tell that i am using Pascal fpc.

A function returns a value and a procedure just executes commands.The name function comes from math. It is used to calculate a value based on input.
A procedure is a set of command which can be executed in order.
In most programming languages, even functions can have a set of commands. Hence the difference is only in the returning a value part.But if you like to keep a function clean, (just look at functional languages), you need to make sure a function does not have a side effect.

1 Like

what do you mean by saying that a function doesn’t have a side effect ?

Side effects refers to scope.
Scope restriction.

1 Like

what does scope means in programming?

Scope means whether your data is global or local.
If its Global, any outer fuction can manipulate it.

1 Like
//