What is the difference between a function and a subroutine?

前端 未结 11 1559
攒了一身酷
攒了一身酷 2021-01-30 06:32

What is the difference between a function and a subroutine? I was told that the difference between a function and a subroutine is as follows:

A function takes parameters

11条回答
  •  鱼传尺愫
    2021-01-30 07:07

    In terms of Visual Basic a subroutine is a set of instructions that carries out a well defined task. The instructions are placed within Sub and End Sub statements.

    Functions are similar to subroutines, except that the functions return a value. Subroutines perform a task but do not report anything to the calling program. A function commonly carries out some calculations and reports the result to the caller.

提交回复
热议问题