procedure TForm1.Button1Click(Sender: TObject);
var
  x: Integer;
  label n1,n2,n3,4;  //goto的标签可以是标识符, 也可以是0..9999的数字
begin
  x := 0;
  goto n3;
  n1: x := x+1;
  n2: x := x+2;
  n3: x := x+3;
  4:  x := x+4;
  ShowMessage(IntToStr(x));  //返回7而不是10
end;

posted on 2007-11-26 22:55  万一  阅读(5440)  评论(6编辑  收藏  举报