本文整理自网络,侵删。
Delphi 2009 中 Exit 的新用法
Nick 描述了 Exit 在 Tiburon 中的新语法,看代码:
function foo(const I: Integer): string;begin if I < 0 then Exit('负数'); Result := '正数'; end; function foo(const I: Integer): string;begin if I < 0 then begin Result := '负数'; Exit; end; Result := '正数'; end; 可以看到,Exit 的语言构造发生了变化,可以像函数一样带一个参数,参数类型就是 Result 的类型,退出函数的同时返回函数的值,与 Java、C# 等其它语言的 Return 功能一样。
相关阅读 >>
Delphi stringgrid 实例2:1、获取 stringgrid 的行数、列数; 2、给单元赋值
Delphi 的 webservice 的 cookie 操作
更多相关阅读请进入《Delphi》频道 >>