对于黄家强ppt里面的一个程序,有点不懂。求教各位大虾!
# k4 @( n: y( v& P: O) V/ W" }(product:object):boolean
7 ]+ c1 i4 {$ yis7 Y& M0 G4 d( X! w
do
, e& b+ p2 s! o6 o partstatistics.cursorX:="color";
, X* J( U1 n6 z+ `! X. h d partstatistics.cursorY:=1;' U- }. B# ^/ T# u7 D
if partstatistics.find(product.CurrIcon) then) H1 }+ m% f1 q, D- Y& w1 _
partstatistics["number",partstatistics.cursorY]:=6 d# X, w: x4 E. @) [
partstatistics["number",partstatistics.cursorY]+1;
1 z- D3 p, S* |+ ^; f result:=true;
! Y6 k, |$ m" R% [& T5 x else
4 R* H: v" P6 v result:=false;
/ O, H9 M* J5 o( v7 s6 p end;) e+ A, u& C7 p. E% U8 i, l
end;5 t, ~: e9 o( @* i
( Y6 L7 z# O" S. u“partstatistics.cursorY:=1;”3 r' f& H' u3 n. J+ E" V! h
这一句怎么理解,他对partstatistics.cursorY赋值为1,那么后面的partstatistics["number",partstatistics.cursorY]不就变成了partstatistics["number",1],这样只能在number这一列的第一行里统计颜色的数量了。 h: {. Y3 S) f U
但它的结果是在五行里统计出各种颜色的数量。 |