매개변수가 있는 Exit 시험

838 단어
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.

 
 
 
 
 

 

 
  

좋은 웹페이지 즐겨찾기