A most common construct in a Delphi application would be a procedure or a function. Known as routines, procedures or functions are statement blocks you call from different locations in a program.
Delphi应用程序中最常见的构造是过程或函数 。 从程序中不同位置调用的语句块称为例程,过程或函数。
Simply put a procedure is a routine not returning a value while a function returns a value.
简单地说,过程是例程,函数返回值时不返回值。
A return value from a function is defined by the return type. In most cases you would write a function to return a single value that would be an integer, string, boolean or some other simple type, also return types could be an array, a string list, an instance of a custom object or alike.
函数的返回值由返回类型定义。 在大多数情况下,您将编写一个函数以返回单个值 ,该值可以是整数,字符串,布尔值或其他一些简单类型,返回类型也可以是数组,字符串列表,自定义对象的实例等。
Note that even if your function returns a string list (a collection of strings) it still returns a single value: one instance of the string list.
请注意,即使你的函数返回一个字符串列表(集合字符串 ),它仍会返回一个值:字符串列表中的一个实例。
Further, Delphi routines can really have many faces: Routine, Method, Method Pointer, Event Delegate, Anonymous method...
此外,Delphi例程确实可以有很多面Kong:例程,方法,方法指针,事件委托,匿名方法...
函数可以返回多个值吗? ( Can a Function Return Multiple Values? )
The first answer that comes to mind is no, simply because when we think of a function, we think of a single return value.
我想到的第一个答案是不,仅仅是因为当我们想到一个函数时,我们想到的是一个单一的返回