对于黄家强ppt里面的一个程序,有点不懂。求教各位大虾!
2 A9 e" w2 z0 g, x' `(product:object):boolean9 j. \& e8 }3 x# i Y6 t/ g Y9 `
is W! Y8 m- w/ J9 w c; y
do
# Y: ~" a( t G( W partstatistics.cursorX:="color";
9 H; S, h9 W, z6 c1 z0 ~5 L! p partstatistics.cursorY:=1;# n& |0 |. T, @+ \3 u0 F/ ?. [4 d
if partstatistics.find(product.CurrIcon) then C- T; U4 W, C2 |4 K( n, f
partstatistics["number",partstatistics.cursorY]:=
+ H S( B. }6 R partstatistics["number",partstatistics.cursorY]+1;& \, s6 E p: X; [! e! d. P
result:=true;7 J- d3 N5 n9 H
else
2 `0 y- J8 T$ E: S0 a" i result:=false;+ O( u: J- L( k3 E& A V
end;
8 d. G" S# B7 a2 I* Cend;+ \( [6 e. M2 n, x; b
7 c, P0 u- X) z, u“partstatistics.cursorY:=1;”
0 Z% D. e$ j0 ~% x这一句怎么理解,他对partstatistics.cursorY赋值为1,那么后面的partstatistics["number",partstatistics.cursorY]不就变成了partstatistics["number",1],这样只能在number这一列的第一行里统计颜色的数量了。9 T- d9 ~, n$ _/ }- L
但它的结果是在五行里统计出各种颜色的数量。 |