为什么这里的exit不起作用呢,请知道的帮帮忙呀!!!!!!!(100分)

  • 主题发起人 主题发起人 nanshan
  • 开始时间 开始时间
N

nanshan

Unregistered / Unconfirmed
GUEST, unregistred user!
[:(]
function Isplatecolor(pp: pRGBTripleArray; qx, zx, Y: word): word;
var
i, hw, la, ba, he: word;
r, g, b: word;
begin
hw := 0;
la := 0;
ba := 0;
he := 0;
Result := 0;
for i := qx to zx do
begin
r := pp.rgbtRed + 1;
g := pp.rgbtGreen + 1;
b := pp.rgbtBlue + 1;
if ((r / g) > 0.7) and ((b / g) > 1) and ((r / b) > 1) then
Exit;//这里的exit调试的时候断点是打叉的,明显不执行,不知道为什么。
if (r > 200) and (g > 200) and (b > 200) then
INC(ba) else
if (r < 50) and (g < 50) and (b < 50) then
INC(he) else
if ((r / g) > 1) and ((g / b) > 5) and ((r / b) > 9) then
INC(hw) else
if ((b / g) > 1.8) and ((g / r) > 1.5) and ((b / r) > 3) then
INC(la);
end;
if (ba > ((zx - qx) div 3)) then
Result := 3;
if (he > ((zx - qx) div 2)) then
Result := 4;
if (hw > ((zx - qx) div 8)) then
Result := 1;
if (la > ((zx - qx) div 5)) then
Result := 2;
end;
 
那证明 If 的条件不成立。
 
好象exit都是这样的,在exit的地方设断点都是显示好象无效断点样,事实上会运行的
 
我找到问题了,好像是必须在exit前加一个Result := 0;,大概是要求退出前提交返回值吧,不知道说对了没有,反正问题是这样解决的,给以后有遇到这类问题的人积累点经验。

解决方法:
if ((r / g) > 0.7) and ((b / g) > 1) and ((r / b) > 1) then
begin
Result := 0;
Exit;
end;
 
后退
顶部