且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何将另一个函数返回的函数分配给函数变量?结果而不是生成函数本身

更新时间:2023-02-11 21:58:09

如果您的匿名方法/函数是无参数的,则必须分配();

If your anonymous methods/functions are paramless, you must assign with ();

v1 := GetHandler();

在没有括号的情况下,Delphi将尝试将功能分配给变量.括号告诉它调用该函数并将函数结果分配给该变量.

Without the parentheses Delphi will try to assign the function to the variable. The parens tell it to invoke the function and assign the function result to the variable.