What is the main difference between sub-procedure and function?
The sub-procedure is a block of multiple visual basic statements within Sub and End Sub statements. It is used to perform definite tasks, such as changing properties of objects, receiving or processing data, and displaying an output. You can explain a sub-procedure anywhere in a program, like in modules, structures, and classes.
We can also give arguments in a sub-procedure; though, it does not return a new value.
The function is also a set of statements within the Function and End Function statements. It is same to sub-procedure and performs the similar task. The main difference among a function and a sub-procedure is that sub-procedures do not return a value while functions do.