对于黄家强ppt里面的一个程序,有点不懂。求教各位大虾!
9 D( j3 O: o/ I5 Y9 J# w4 S(product:object):boolean
4 z, }. Z9 }! \+ Sis h1 c! A& o9 `
do
6 u5 Q, ?6 ^/ s4 J" u partstatistics.cursorX:="color";8 \/ |/ a6 _# A# Q: ~
partstatistics.cursorY:=1;
x; S4 e9 B9 U" o* E G& Q8 b if partstatistics.find(product.CurrIcon) then
) _$ H* F, }% u5 k partstatistics["number",partstatistics.cursorY]:=$ v8 V5 S/ ] |2 |! @8 {% h
partstatistics["number",partstatistics.cursorY]+1;
% R3 C: i" G& f. K, x5 _% e result:=true;
+ X" B# B0 m+ b3 R# h, _6 A else
% p" n4 _3 }/ O" w+ b+ S1 i result:=false;
1 q- H( p" {1 `9 \, b end;
9 y9 r& y0 u) m0 k. O3 T4 nend;$ ]% H% \; d0 b: x0 `7 K" l' r/ ^& s
4 Y0 j: S' g' X1 P3 P1 c* g* w“partstatistics.cursorY:=1;”
$ d' j$ t6 m0 t7 m这一句怎么理解,他对partstatistics.cursorY赋值为1,那么后面的partstatistics["number",partstatistics.cursorY]不就变成了partstatistics["number",1],这样只能在number这一列的第一行里统计颜色的数量了。# n' B/ h, h0 g3 s' ?$ _' B# X5 `
但它的结果是在五行里统计出各种颜色的数量。 |