对于黄家强ppt里面的一个程序,有点不懂。求教各位大虾!
+ S& A4 V4 R, }2 K( y(product:object):boolean
+ Q' d7 P7 U* v$ Vis9 |$ j' ~+ E. K' }: ~0 Z0 e# Q6 h
do
, b5 I4 H3 M% P g5 e8 Z, v partstatistics.cursorX:="color";" ~, Q4 o6 f# N* ]" W* |3 V
partstatistics.cursorY:=1;
* r3 U! K' y! w( L, A if partstatistics.find(product.CurrIcon) then
5 w2 H: L/ y# t, c R8 _ partstatistics["number",partstatistics.cursorY]:=
+ w4 K8 [. v6 W0 v/ M! p; Y partstatistics["number",partstatistics.cursorY]+1;8 U4 ]7 K; `: o7 {" @6 X8 [/ H A
result:=true;
6 e L& R$ S) y7 t2 h2 T$ K/ f else
! W% z; C9 ]. L8 p, h8 I+ e k result:=false;& ^/ T4 F1 T) W0 s9 `
end;
0 S0 Y4 c+ i, S) w- Xend;9 G* S+ U) e% M% q, E
/ q1 O: X$ M' |7 L6 W( V( {
“partstatistics.cursorY:=1;”% R. e& A# f; R: e! U8 w3 S
这一句怎么理解,他对partstatistics.cursorY赋值为1,那么后面的partstatistics["number",partstatistics.cursorY]不就变成了partstatistics["number",1],这样只能在number这一列的第一行里统计颜色的数量了。3 z4 J4 z! y/ U" t" f0 Q2 K; s/ i
但它的结果是在五行里统计出各种颜色的数量。 |