对于黄家强ppt里面的一个程序,有点不懂。求教各位大虾!
) }0 Y! i4 ^" h @' J# U) B5 A0 i(product:object):boolean
9 \2 T0 B ]- p7 h8 pis
+ Z& s3 `$ v4 A0 \do2 J) t0 g A/ N4 ]* W4 X
partstatistics.cursorX:="color";" ]/ U- F, t- t% M0 N* \8 D
partstatistics.cursorY:=1;
1 p* u+ Q1 [3 a, @* F2 x! W# s if partstatistics.find(product.CurrIcon) then! U/ g8 R B! f/ ]! Z; P2 M
partstatistics["number",partstatistics.cursorY]:=3 `( x9 @0 |5 G& k* v( _( ~
partstatistics["number",partstatistics.cursorY]+1;: A4 H( X6 X: u$ K, f
result:=true;% G8 X/ a% t; E! I, @ o' p5 o; [
else
" c3 n. R7 s- v6 B- u0 O result:=false;
0 }% \3 ?5 K1 ?5 e+ v# A end;, V1 V+ \/ i- y, g% n7 H
end;) @2 ~. u1 I- P7 A" V# x$ ?
+ A0 m* P. B5 q“partstatistics.cursorY:=1;”* z/ a' }% G) X8 z: X d
这一句怎么理解,他对partstatistics.cursorY赋值为1,那么后面的partstatistics["number",partstatistics.cursorY]不就变成了partstatistics["number",1],这样只能在number这一列的第一行里统计颜色的数量了。6 B! h$ ?1 Z# {1 P- V# \+ a5 c/ z* C
但它的结果是在五行里统计出各种颜色的数量。 |