对于黄家强ppt里面的一个程序,有点不懂。求教各位大虾!
% g0 Z4 R3 q3 `(product:object):boolean4 z" b+ K" [5 R' Z% I
is8 x5 B% w7 D: Q
do
3 U2 W2 |/ Z) y3 P2 \; c: Y partstatistics.cursorX:="color";
5 f% S, @8 J# L" o6 Y( t; k1 t partstatistics.cursorY:=1;1 ?9 u) h, w& U9 [% o
if partstatistics.find(product.CurrIcon) then! F! K# \/ |, A% ~3 h# T
partstatistics["number",partstatistics.cursorY]:=8 L8 _' \! F* f0 B
partstatistics["number",partstatistics.cursorY]+1;
& u5 O% q: C/ n5 @; Y0 C5 |$ B result:=true;2 P- t4 ]9 D$ U# o w1 [! ]( \
else& U2 s! Q& r: p, J, q4 V
result:=false;3 j, r- @# O4 G" s
end;
' F* N+ f9 Q) H5 r0 L+ Tend;9 y+ F/ ~6 m, d1 F' {
! @! B" ?9 \+ |- s% ]% j
“partstatistics.cursorY:=1;”
3 l6 f( j2 x& \" o, }这一句怎么理解,他对partstatistics.cursorY赋值为1,那么后面的partstatistics["number",partstatistics.cursorY]不就变成了partstatistics["number",1],这样只能在number这一列的第一行里统计颜色的数量了。
9 x9 B5 S- I' z# R# i' h7 c但它的结果是在五行里统计出各种颜色的数量。 |