对于黄家强ppt里面的一个程序,有点不懂。求教各位大虾!
0 ]. ~# ~# [3 M" L% u- E: t(product:object):boolean* Q9 c3 m9 }5 a( ?9 O
is
- r4 M. v4 F3 g2 Zdo
9 L0 O: J& n$ }, Z' T7 n5 s4 w! [ partstatistics.cursorX:="color";
( {2 u# z, j$ Y0 `& C, o; F6 A" R partstatistics.cursorY:=1;
8 v7 N+ N0 S( Y8 [ if partstatistics.find(product.CurrIcon) then: {! x7 O4 L! H# g
partstatistics["number",partstatistics.cursorY]:=
! I; N2 R' e. j. S& n% @+ c% A ^ partstatistics["number",partstatistics.cursorY]+1;& V% ^8 E8 i* B5 c* R) l- y7 n/ P, [% u
result:=true; s6 S) }3 M! j3 P' K3 q
else, F5 J/ }% D/ X$ z
result:=false;+ ]5 k7 B0 F" k0 e G: i& I) ?3 A
end;
& D7 B( Q: ^& I8 o; Uend;$ p- \$ Q/ V, W% W8 a6 F7 N) j& ^" _3 z
2 z# o3 k" q1 {1 ]: K! ?) M
“partstatistics.cursorY:=1;”
# H* M, u: c$ j0 d" B% t( {这一句怎么理解,他对partstatistics.cursorY赋值为1,那么后面的partstatistics["number",partstatistics.cursorY]不就变成了partstatistics["number",1],这样只能在number这一列的第一行里统计颜色的数量了。7 W( t8 K0 \) K3 l+ V! F! a
但它的结果是在五行里统计出各种颜色的数量。 |