delphi 带参数的 Exit


本文整理自网络,侵删。

 unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls;

type
  TForm1 = class(TForm)
    Button1: TButton;
    procedure Button1Click(Sender: TObject);
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

function fun(str: string): string;
begin
  if str = '' then Exit('空'); {Delphi 2009 支持}
  Result := str + str;
end;

procedure TForm1.Button1Click(Sender: TObject);
var
  s: string;
begin
  s := fun('ABC');
  ShowMessage(s);  {ABCABC}

  s := fun('');
  ShowMessage(s);  {空}
end;

end.
--------------------------------------------------------------------------------------------------------------------------------------------------------------

其中的 Exit('空') 相当于

result := '空'

exit; 

相关阅读 >>

Delphi 读取文件获取指定字符串

Delphi中ado异步执行方式

Delphi url protocol 让浏览器运行本地的exe程序

Delphi 中压缩流和解压流的应用

Delphi 获取内网所有ip地址

Delphi 获取窗口矩形的四种方法: getclientrect、clientrect、getwindowrect、boundsrect

Delphi escape/unescape编码

Delphi 新增功能之: ioutils 单元(7): tfile 结构的功能

Delphi 获取国外格式日期时间

Delphi trayicon1 托盘气泡提示

更多相关阅读请进入《Delphi》频道 >>



打赏

取消

感谢您的支持,我会继续努力的!

扫码支持
扫码打赏,您说多少就多少

打开支付宝扫一扫,即可进行扫码打赏哦

分享从这里开始,精彩与您同在

评论

管理员已关闭评论功能...