各位大侠:
    小弟刚学delphi,有些语法不懂,请大家指教!
    我想写个函数,不需要返回值,只是实现某个功能!可是不知道函数格式,请大家给段类似的代码!谢谢!

解决方案 »

  1.   

    用过程
    procedure f;
    begin
      //...
    end;
      

  2.   

    没搞错吧,上面不是给你写了。如果看不懂语法,赶快找本有讲pascal语法的书来看看。
      

  3.   

    过程,过程,过程
    procedure 过程名(参数列表)
    begin
      代码;
    end;
    用d创建一个空form,看看form的事件处理代码,统统是过程,没有返回值
      

  4.   

    嘿嘿,你在学步之前问如何学步,
    你先慢慢走就是了嘛。
    C/C++的函数在pascal中分为两种:函数(带返回值)与过程(无返回值)
      

  5.   

    过程名后面可以不带参数吗?怎么调用这个过程啊?这样行吗?如果此过程为:
    procedure abc
    bengin
    .....
    end;if 条件成立 then
       bengin
             abc
       end;
      

  6.   

    Object Pascal reference 不错的
      

  7.   

    很简单,要返回值用
    function 函数名(参数列表)
    begin
    Result := ...;
    end;不要返回值用:
    procedure 过程名(参数列表)
    begin
    end;
      

  8.   

    用过程,上面你的例子已经正确了。调用过程很简单的。就象你用的if 条件成立 then abc;
      

  9.   

    unit main;interfaceuses
      Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
      Dialogs,Inifiles, StdCtrls, ComCtrls, Buttons, DB, ADODB;type
      TForm1 = class(TForm)
        Button1: TButton;
        procedure DataFilter;
        procedure Button1Click(Sender: TObject);  private  public
        { Public declarations }
      end;var
      Form1: TForm1;implementation
    {$R *.dfm}
    procedure TForm1.DataFilter;
    begin
      showmessage('调用过程');
    end;procedure TForm1.Button1Click(Sender: TObject);
    begin
      DataFilter;
    end;end.