对于黄家强ppt里面的一个程序,有点不懂。求教各位大虾!6 j5 y- t. D9 s0 ~$ J
(product:object):boolean) Y$ Y' k: _ U0 a: _: W
is, N& s1 G) e7 ^
do% r* s r9 }; y: p" a$ z8 y$ z9 h
partstatistics.cursorX:="color";+ e j& b. k& |7 s; S( Z
partstatistics.cursorY:=1;
' P, _2 `2 ?7 }9 n2 B5 M: P if partstatistics.find(product.CurrIcon) then3 ]# l: x6 x; d3 \
partstatistics["number",partstatistics.cursorY]:=% X4 h. p4 [$ K, c) S1 }+ N
partstatistics["number",partstatistics.cursorY]+1;9 l" f6 M) @9 F, s! Y$ e0 \
result:=true;0 Q0 [; a; m: O1 E
else1 B& F& v- G. B
result:=false;1 U, n: Q+ K6 v' c, H. j3 U
end;8 u* }5 ^4 }' O) _% [! N
end;
1 z, P. p& Z6 s8 `5 _/ ~3 m
& ^2 ^( r) C2 Q; H+ P" [* E* ?“partstatistics.cursorY:=1;”/ L8 W: t. t+ E, p1 B( I1 L& t, |- f2 ?
这一句怎么理解,他对partstatistics.cursorY赋值为1,那么后面的partstatistics["number",partstatistics.cursorY]不就变成了partstatistics["number",1],这样只能在number这一列的第一行里统计颜色的数量了。. F; L' ~- q5 s
但它的结果是在五行里统计出各种颜色的数量。 |