对于黄家强ppt里面的一个程序,有点不懂。求教各位大虾!, i- }/ c. P5 M' R, Z' f
(product:object):boolean
7 M( ]3 S! `, z. Y- Zis) \8 e# I8 _3 T' t! u1 b* O+ {
do/ B" q# L: b$ |' Q8 f
partstatistics.cursorX:="color";
! N% V. D3 e k partstatistics.cursorY:=1;
2 e: l% l( N6 ]5 R( _, E) T if partstatistics.find(product.CurrIcon) then
$ g' O5 L: @1 t+ N) S/ h partstatistics["number",partstatistics.cursorY]:= b# O- g+ x" O$ \* L+ o- Z
partstatistics["number",partstatistics.cursorY]+1;8 Z5 c6 j$ P3 T
result:=true;, \! [2 x1 O* [
else% }1 E2 V% h& ?$ ?* X, x
result:=false;3 q; r' U8 O* `: D" G4 f+ x
end;( \# H, y) P, ^% `) M# H' K9 S
end;# z4 V5 } s$ I. y- H7 X
% s5 L3 z* w1 {, d% M
“partstatistics.cursorY:=1;”
' z+ s" ~6 u& o, x4 f2 k这一句怎么理解,他对partstatistics.cursorY赋值为1,那么后面的partstatistics["number",partstatistics.cursorY]不就变成了partstatistics["number",1],这样只能在number这一列的第一行里统计颜色的数量了。. L% v z& @8 D( L& c
但它的结果是在五行里统计出各种颜色的数量。 |