对于黄家强ppt里面的一个程序,有点不懂。求教各位大虾!3 d; }- Q; l7 b! @, Y+ M3 v
(product:object):boolean
$ O! b+ I4 E9 m% M0 r* cis7 _+ q5 w) C1 J. y
do# b7 C0 i$ r. n
partstatistics.cursorX:="color";
3 `3 y. R3 J* M* l2 B0 [5 P partstatistics.cursorY:=1; q& [2 N# F8 Y) n6 p2 r
if partstatistics.find(product.CurrIcon) then# V2 m; c, `/ X
partstatistics["number",partstatistics.cursorY]:=/ e- ?, C3 c" z9 j* ?
partstatistics["number",partstatistics.cursorY]+1;
& S# Z2 ~3 o! a) b% q; _& a result:=true;
! L" R6 w7 H! H1 X' P$ G, A6 @ else
- _- ]8 [. G+ N- L result:=false;/ H, s! B4 N1 e3 a0 s* l% p
end;
9 A; K5 y' k; O: d1 p4 Wend;3 ]! F! h9 S, a7 L) J
/ E& S8 c5 W! n$ J% x, ?“partstatistics.cursorY:=1;”
7 ^5 N6 A& U& r这一句怎么理解,他对partstatistics.cursorY赋值为1,那么后面的partstatistics["number",partstatistics.cursorY]不就变成了partstatistics["number",1],这样只能在number这一列的第一行里统计颜色的数量了。0 M, x0 Z4 O: u$ T. u8 E G
但它的结果是在五行里统计出各种颜色的数量。 |