📜  程序与函数的区别

📅  最后修改于: 2021-09-11 04:41:54             🧑  作者: Mango

1. 程序:
程序,顾名思义,是计算机用来执行特定任务的指令集或集合,这些指令是使用特定的编程语言(例如 C++、 Python、Ruby 等)创建的。

2.函数:
函数,顾名思义,是计算机编程中的基本概念,调用它来控制程序流以及执行特定任务,返回一个值并在调用它的地方恢复程序。

程序与函数的区别:

Program Function
Programs are set of instructions executed by computer. Function is block of organized and reusable code.
Programs has to instruct computer to do particular task. Functions has to perform action or related action.
Programs do not return any result. Function usually return result that can be graphed or entered in table.
It provides framework that set direction of program as well as plan about how objective will be achieved. It provides better modularity for application as well as high degree of reusing code.
It cannot store local and global variables. It can store local and global variables.
Types of programs include system programs, application programs, utility programs, etc. Types of function include modulus function, linear function, quadratic function, exponential function, etc.
Program consists of compiled code that run directly from computers operating system. Functions can be used over and over again once it is defined.
It is larger in size and does not require scripting engine to run. Functions are smaller in size as compared to programs.
Programs are written in both low-level and high-level programming languages and are human readable and writable. Functions can be both low-level or top-level functions.