![](https://i-blog.csdnimg.cn/blog_migrate/7a60c18f40e20d21b1b0e7c0c725bb08.png)
程序员t5和t7差距
Procedure: In computer programming a specific set of instructions together called a procedure. Depending on the programming language it can be called as subroutine, subprogram or a function.
过程:在计算机编程中,一组特定的指令统称为过程。 根据编程语言的不同,它可以称为子例程,子程序或函数。
Function: It is one of the basic concept in programming of computer. As it name says, it performs a function (work). It can be either user defined or system defined. More technically it is a block of code in program which performs specific task.
功能:它是计算机编程中的基本概念之一。 顾名思义,它执行一项功能(工作)。 它可以是用户定义的,也可以是系统定义的。 从技术上讲,它是程序中执行特定任务的代码块。
功能与程序之间的差异 (Difference between Function and Procedure)
Procedure | Function |
It is set of instructions in a program. | It also a set of instructions, but we can say it’s a variant of a procedure. |
May or may not return a value to the code called by. It just executes commands. | Functions are very similar to procedures except that they also return a value to the calling sub program. |
Procedure can contain return statement. | Function should contain return statement. |
Procedure is set of commands executed in order | Function is used to calculate something from given input to it. So its name came from math. |
Procedure cannot be called from a function. | Function can be called from a procedure. |
In SQL, inside procedure we can use DML (Insert, Delete, Update) Commands. | In SQL, inside functions we can’t use DML commands. |
Pascal, Ada, PL/SQL are some programming languages which uses procedure. | C, C++, Java are some programming languages which uses functions. |
程序 | 功能 |
它是程序中的指令集。 | 它也是一组指令,但是我们可以说这是一个过程的变体。 |
可能会或可能不会将值返回给调用的代码。 它只是执行命令。 | 函数与过程非常相似,不同之处在于它们还向调用子程序返回一个值。 |
过程可以包含return语句。 | 函数应包含return语句。 |
过程是按顺序执行的命令集 | 函数用于根据给定的输入来计算内容。 所以它的名字来自数学。 |
无法从函数调用过程。 | 可以从过程中调用函数。 |
在SQL内部过程中,我们可以使用DML(插入,删除,更新)命令。 | 在SQL中,内部函数不能使用DML命令。 |
Pascal,Ada,PL / SQL是一些使用过程的编程语言。 | C,C ++,Java是一些使用函数的编程语言。 |
翻译自: https://www.thecrazyprogrammer.com/2019/01/difference-between-function-and-procedure.html
程序员t5和t7差距