对于黄家强ppt里面的一个程序,有点不懂。求教各位大虾!
9 K. j% H% K2 l(product:object):boolean
1 |2 z r- Y, m' t. `+ N6 qis
6 s$ I u- {, }! ]" K1 D& mdo
% `' \' H5 e& U8 _2 _2 J4 S partstatistics.cursorX:="color";
7 H) ?8 G( D# ?/ S/ n9 F% k* j- M partstatistics.cursorY:=1;- [' L/ B9 e' z/ b! Y+ l6 |% C
if partstatistics.find(product.CurrIcon) then
# ?3 Q8 u1 J* f) f, `: ]- w partstatistics["number",partstatistics.cursorY]:=/ s; y& M$ X9 ^: m6 j. n" D+ L
partstatistics["number",partstatistics.cursorY]+1;
% N3 a* B# I3 [5 C1 A$ l result:=true;
7 j, J- y8 G6 n6 Q4 U& P else
; |; r# K @( |. F, Y result:=false;
( K4 Q) o. ?! a8 S end;; Q# g0 a# c" h7 E( G6 R3 \
end;+ V! b, u# ~ U1 Q% |! `- O
1 H. R" t' s% H% `4 m
“partstatistics.cursorY:=1;”
! q, G2 ] V: e% u这一句怎么理解,他对partstatistics.cursorY赋值为1,那么后面的partstatistics["number",partstatistics.cursorY]不就变成了partstatistics["number",1],这样只能在number这一列的第一行里统计颜色的数量了。
) k" z0 S* b2 |" c1 ^但它的结果是在五行里统计出各种颜色的数量。 |