procedure GLimit(i:integer); begin case i of 1:showmessage('你输入的是:'+inttostr(i));//输入1测试了下 具体改成你想要操作,多 //语句的话,用begin ... end;括住 //2:表达式; //... end;end;procedure TForm1.Button1Click(Sender: TObject); begin GLimit(strtoint(edit1.Text)); end;//上述先定义一个过程GLimit(i),然后在另一个过程调用它. //过程和函数里面不能再定义过程或函数,只能调用已定义好的函数或过程.//我也是菜鸟 哈哈.第一次回答别人的问题.解决了就给分吧
function GLimit(i: integer): string; begin case i of 0: result := 'heihei'; 1: result := 'haha'; end; end;procedure tform1.button1click(sender: tobject); begin showmessage(glimit(0)); end;
case GLimit of
0:....
1:....
2:.....
声明和实现不一致通不过编译的
先把概念理清吧
begin
case i of
1:showmessage('你输入的是:'+inttostr(i));//输入1测试了下 具体改成你想要操作,多
//语句的话,用begin ... end;括住
//2:表达式;
//...
end;end;procedure TForm1.Button1Click(Sender: TObject);
begin
GLimit(strtoint(edit1.Text));
end;//上述先定义一个过程GLimit(i),然后在另一个过程调用它.
//过程和函数里面不能再定义过程或函数,只能调用已定义好的函数或过程.//我也是菜鸟 哈哈.第一次回答别人的问题.解决了就给分吧
begin
case i of
0: result := 'heihei';
1: result := 'haha';
end;
end;procedure tform1.button1click(sender: tobject);
begin
showmessage(glimit(0));
end;