if shape='' then exit;
如果shape='' 就退出程序,想在exit 之前先弹出个提示框,
比如 if shape='' then ShowMessage('请先选择要删除的物体'); exit;     改怎么写?还有个问题问一下,
    if k=1 then 
     i:=2;
     n:=3;
k=1条件成立的话, i:=2;n:=3;这两句语句会不会都执行,想让 i:=2; n:=3;都执行,要怎么写?

解决方案 »

  1.   

    if XXX then
    begin
      showmessage..
      exit;
    end;
      

  2.   

    ShowMessage不能选择,如果一定要用类似的对话框可以尝试下这段代码var
      s1:string;
    begin
      s1:= InputBox(Application.Title,'请先选择要删除的物体','');
      if s1 = '1' then
        ShowMessage('Del 1')
      else if s1 = '2' then
        ShowMessage('Del 2')
      else if s1 = '3' then
        ShowMessage('Del 3')
      else if s1 = '4' then
        ShowMessage('Del 4');
    end;
    if k=1 then //成立
        i:=2; //会执行
    n:=3;//会无条件执行
      

  3.   


    if k=1 then
    begin
      i:=2;
      n:=3;
    end;