I am going through some old VB code and I run into function definitions like these -
Private Function ExistingCustomer(Index As Integer, Customer As String)
A function holds data and code. But a subroutine contains only code, but not data.
In function we can return values as boolean, string and other data data types.
but sub does not return any thing. it just executes code and instruction that we give. These are also regarded as methods
Sub is also used in control's events and these events also not return any value.
for example the click event of a command button: Private sub cmd_click()
end sub