使用goto语句,但不到万不得以最好不要使用 function .... label label1 begin label1: goto label1 ; end ;
repeat if a=0 then begin 程序主体; break; end else continue; until true;
repeat if a=0 then begin 程序主体; break; end else continue; until true;
用错了::=)应该是这样的: if a<>0 then 这里执行你的else中的语句然后执行你的then中的语句========================================如果你的else要转到的只是then中后一部分,如: if a=0 then begin S1; // 这是只属于then的 S2; // 这是属于then和else的 end else S3; // 这是只属于else的那么可以改写为: if a=0 then S1 // 这是只属于then的 else S3; // 这是只属于else的S2; // 这是属于then和else的==============================================如果你的情况比较复杂,如else中是有条件地转移或用到then中的部分语句,那么我建议你把他们封装到一个过程或函数中,然后分别调用。pascal中嵌套过程刚好满足这种应用,因为它们是共享主过程中的局部变量的。
begin
continue;
程序主体;
end
function ....
label label1
begin
label1: goto label1 ;
end ;
if a=0 then
begin
程序主体;
break;
end
else continue;
until true;
if a=0 then
begin
程序主体;
break;
end
else continue;
until true;
if a<>0 then
这里执行你的else中的语句然后执行你的then中的语句========================================如果你的else要转到的只是then中后一部分,如:
if a=0 then
begin
S1; // 这是只属于then的
S2; // 这是属于then和else的
end
else
S3; // 这是只属于else的那么可以改写为:
if a=0 then
S1 // 这是只属于then的
else
S3; // 这是只属于else的S2; // 这是属于then和else的==============================================如果你的情况比较复杂,如else中是有条件地转移或用到then中的部分语句,那么我建议你把他们封装到一个过程或函数中,然后分别调用。pascal中嵌套过程刚好满足这种应用,因为它们是共享主过程中的局部变量的。