对于黄家强ppt里面的一个程序,有点不懂。求教各位大虾!
: u: m- _8 u+ ^5 }3 \/ u v5 W(product:object):boolean8 d" Q1 [* }/ P3 D7 E, k7 N& q
is
5 s, S9 E: n1 R9 Ldo w2 t# Z: b [( z
partstatistics.cursorX:="color";
# ?! h5 X( Q2 y- X- \, | partstatistics.cursorY:=1;* s8 {: n; X4 B' ~5 [
if partstatistics.find(product.CurrIcon) then
' D3 k8 w p+ `6 H) B partstatistics["number",partstatistics.cursorY]:=
& f0 R: T' d' p" |+ r3 \4 Q) D* [ partstatistics["number",partstatistics.cursorY]+1;+ P6 e) g3 n- c) x" J" q1 b5 Y3 F) g
result:=true;* i N, j G$ K( ~ T w% C
else" Y; n* ?( @; B8 e3 E
result:=false;
- C3 A1 ^5 n" d$ v end;; }7 c5 v+ |& j/ m2 O5 M \
end;% e$ N: Y8 G7 Y$ W5 F( C+ ~
# N) d+ Y6 x: l4 p4 G& u
“partstatistics.cursorY:=1;”! m1 @3 T9 B; s& C5 j, z5 l' |& r" j
这一句怎么理解,他对partstatistics.cursorY赋值为1,那么后面的partstatistics["number",partstatistics.cursorY]不就变成了partstatistics["number",1],这样只能在number这一列的第一行里统计颜色的数量了。
# @* B0 \, E# P# ]但它的结果是在五行里统计出各种颜色的数量。 |