What is the difference between Sub and Function in VB6?

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

    What is the difference between Sub and Function in VB6?

    "sub" can perform some action. "sub" returns no value.

    Example:

    Form_Load()

    "function" can also perform some action but it also returns some value to point from which it was called. that is, "Functions return a value, often based on a variable"

    Example:

    Val(), FormatPercentage().

提交回复
热议问题