What is the difference between Sub and Function in VB6?

前端 未结 8 1854
孤城傲影
孤城傲影 2020-12-25 09:57

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)         


        
8条回答
  •  生来不讨喜
    2020-12-25 10:39

    They are both sections to write code however a function must return a value. For example if you had a program in which a complicated mathematical procedure needs to be executed a number of times you would simply make a function and have the complicated maths code in there and any time you need to do the calculation you can just call the function. Hope this helped not sure if I explained it well.

提交回复
热议问题