不会吧,showmessage下 var i:integer; begin showmessage(inttostr(Length(code))); for I := 1 to Length(code) - 1 do begin if (I mod 2 = 0) then//当余数为0时为true,但好象一直没有为真,错在哪里呢? begin showmessage('i='+inttostr(i)+',为真'); end; end;end;
代码没看出问题,你看看Length(Code)是多少?
代码没错,我原样copy去试验了一下,没问题,是不是其他地方出错了,自己再看看吧。
你的似乎有另外一个问题,当然与本题无关: for I := 1 to Length(code) - 1 do 这句不能完全遍历code位
var
i:integer;
begin
showmessage(inttostr(Length(code)));
for I := 1 to Length(code) - 1 do
begin
if (I mod 2 = 0) then//当余数为0时为true,但好象一直没有为真,错在哪里呢?
begin
showmessage('i='+inttostr(i)+',为真');
end;
end;end;
for I := 1 to Length(code) - 1 do
这句不能完全遍历code位
showmessage();
看看信息在传递时,有什么?????????