What is the difference between a function and a subroutine?

前端 未结 11 1582
攒了一身酷
攒了一身酷 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:18

    I disagree. If you pass a parameter by reference to a function, you would be able to modify that value outside the scope of the function. Furthermore, functions do not have to return a value. Consider void some_func() in C. So the premises in the OP are invalid.

    In my mind, the difference between function and subroutine is semantic. That is to say some languages use different terminology.

提交回复
热议问题