What is the difference between Sub and Function in VB6?

前端 未结 8 1960
孤城傲影
孤城傲影 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:36

    1. Syntax of functions will be Function...End function and for Sub will be Sub...End Sub.
    2. Functions may or may not have objects but sub doesn't have objects
    3. Functions are re-usable where Sub doesn't
    4. Functions can return values but sub doesn't
    5. Functions may have object repository but sub doesn't
    6. Extension of functions is .qfl where for sub it's .vba

提交回复
热议问题