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 webbrowser1遍历网页中的图片

Delphi 关于选择文件路径 selectdirectory 弹出窗口居中的问题

Delphi 判断当前程序是否是活动窗口

Delphi的idhttp报508 loop detected错误的原因

Delphi formactivate与formshow事件有什么区别

Delphi系统默认语言与系统支持的语言列表

Delphi 使format输出百分号 %

Delphi 校验手机号及身份证号

Delphi 编写activex控件(ocx控件)的知识和样例

Delphi 获取局域网所有ip

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



打赏

取消

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

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

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

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

评论

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