对于黄家强ppt里面的一个程序,有点不懂。求教各位大虾!, L! U) a& z, H+ [+ r
(product:object):boolean/ D1 N! [8 V8 y2 I* P
is; p2 l) m k3 L
do
6 [* w, p. O1 e; [1 o; Q) i9 l: s- N partstatistics.cursorX:="color";1 Y$ ^9 y/ V" e5 j3 w- P& Z
partstatistics.cursorY:=1; J. t: T2 ?; O" o$ S+ s
if partstatistics.find(product.CurrIcon) then# i; i% }/ }6 _5 C( } A6 ~6 G$ S, Z
partstatistics["number",partstatistics.cursorY]:=
8 V) @& f! h9 t9 n4 l partstatistics["number",partstatistics.cursorY]+1;
8 O9 O, s. z3 ]7 e1 j9 d6 ] result:=true;
. n6 N; J8 O/ X& n5 z2 r9 ~ else! e+ b% E* \5 Z, l4 P2 z
result:=false;/ [3 X" w/ w+ r& \
end;2 e5 b! i1 d, n4 U, c% S- C
end;& B1 Z) n+ F) ^1 U% A& G; }, p* Q4 z
: g/ l* \* W" e( x t2 f
“partstatistics.cursorY:=1;”. K* Z# C# l1 G
这一句怎么理解,他对partstatistics.cursorY赋值为1,那么后面的partstatistics["number",partstatistics.cursorY]不就变成了partstatistics["number",1],这样只能在number这一列的第一行里统计颜色的数量了。
" a9 N @ R! J6 P5 Y$ E但它的结果是在五行里统计出各种颜色的数量。 |