对于黄家强ppt里面的一个程序,有点不懂。求教各位大虾!
2 f, [1 b6 r' R3 b8 m(product:object):boolean1 r" w" h: k1 ^! ?& F6 i' R
is
# G# K2 C( g# ]+ ?& M4 s, Odo
7 J5 O3 c( K0 L \* p/ L partstatistics.cursorX:="color";, _, A+ P, r: y; G2 {- w3 g
partstatistics.cursorY:=1;) a( n$ j. y1 S/ {) j
if partstatistics.find(product.CurrIcon) then: ?: `9 v4 ^' S' x4 \
partstatistics["number",partstatistics.cursorY]:=$ P% u2 t# I ?- ^% V% [
partstatistics["number",partstatistics.cursorY]+1;
2 {; H! j- A' G2 J* n& l( K result:=true;
* `7 \3 [" Y8 m6 S else! ~; n8 f8 `- ~' O" I( w e! R6 d
result:=false;
' E+ O: U; P% P7 E% [ end;, i* a: s) D' V. _, _, P ^) J
end;
# H' d. N; l% C* {, E* Y& V9 A6 l# P8 s2 q# ^, b" Z: A) {- d* l, w
“partstatistics.cursorY:=1;”' d( Z B% J9 Y0 s! H4 g2 Q7 J
这一句怎么理解,他对partstatistics.cursorY赋值为1,那么后面的partstatistics["number",partstatistics.cursorY]不就变成了partstatistics["number",1],这样只能在number这一列的第一行里统计颜色的数量了。1 f. H$ R" J+ V* @3 j3 N" ]
但它的结果是在五行里统计出各种颜色的数量。 |