var
s:shortint;
t:boolean;case s of
1:begin
....
end;
2:begin
....
end;
3:begin
if t then
调用1
else
调用2
end;如何写这样的代码;;;能调用吗///常量3调用1或2...如何调用呢..帮帮忙啊,高手..
s:shortint;
t:boolean;case s of
1:begin
....
end;
2:begin
....
end;
3:begin
if t then
调用1
else
调用2
end;如何写这样的代码;;;能调用吗///常量3调用1或2...如何调用呢..帮帮忙啊,高手..
1:begin
lab1: ....
end;
2:begin
lab2: ....
end;
3:begin
if t then
goto lab1
else goto lab2;
end;
s:shortint;
t:boolean;case s of
3:begin end;//你如果没有写BREAK,程序会一直往下进行,自然也就运行了1和2的内容
1:begin
....
end;
2:begin
....
end;
在 Delphi 的 Case 语句中是不需要写那个 Break 的!
function proc1( )...
begin
...
end;function proc1( )....
begin
...
end;.....case s of
1:proc1;
2:proc2;
3:begin
if t then
proc1
else
proc2
end;在比较复杂一点的程序里建议少用goto语句,因为降低了程序的可读.容易造成混乱.简单程序里用还是很简练.
var
s:shortint;
t:boolean;
if s=3 then
if t then s:=1 else s:=2
case s of
1:begin
....
end;
2:begin
....
end;