对于黄家强ppt里面的一个程序,有点不懂。求教各位大虾!
: m! O+ ~0 o) N% \: q; @, Q(product:object):boolean1 u2 S7 _6 O& Z1 h. \& j6 f# Z( M
is
" ~/ h8 x1 ^$ d, B4 B: g1 W: fdo4 x0 S+ x: i# [! [# K0 M6 D
partstatistics.cursorX:="color";
/ K. y \# Z: Q7 o: |( ^6 @ partstatistics.cursorY:=1;# t$ b& [% o, D) m9 Q; }7 `* }. i
if partstatistics.find(product.CurrIcon) then; I* ?4 P, r; r
partstatistics["number",partstatistics.cursorY]:=
{5 t0 E+ @$ Y v0 I Z partstatistics["number",partstatistics.cursorY]+1;
8 C, b; _6 o" [1 a$ B) R7 f result:=true;' r3 ?. w+ n# E Y! ?7 G% V
else3 a" M, v: [( ^; |
result:=false;3 E$ [$ r! v3 b0 z% R& Y5 [
end;
& }/ x6 p4 x' N/ j% uend;
6 Y0 t6 C; A5 D, Q' m- b. X. C I" r- @) R3 _& o- e
“partstatistics.cursorY:=1;”
) A. d& Y k* l+ l( U2 h" X这一句怎么理解,他对partstatistics.cursorY赋值为1,那么后面的partstatistics["number",partstatistics.cursorY]不就变成了partstatistics["number",1],这样只能在number这一列的第一行里统计颜色的数量了。
2 r' h+ m! _- h6 c3 M0 `- \; |, @; |但它的结果是在五行里统计出各种颜色的数量。 |