对于黄家强ppt里面的一个程序,有点不懂。求教各位大虾!( i$ x" y, h7 z# i* L# `
(product:object):boolean" F* H: K. L: z3 Z+ P- f# B
is/ p, Z8 s2 O: [: t: a7 ]" Z1 L- i
do5 y- i& u% Q, \2 |5 x7 F
partstatistics.cursorX:="color";& a3 b2 q/ _. t' L0 F( \, Y
partstatistics.cursorY:=1;1 C, e, ?5 f' s% ?5 q6 }
if partstatistics.find(product.CurrIcon) then5 G* f0 n: @1 O3 P A7 ]
partstatistics["number",partstatistics.cursorY]:=1 q; Y0 [1 I# w- i$ c* x4 T
partstatistics["number",partstatistics.cursorY]+1;
0 H4 |: R, W1 g! e% o result:=true;& o9 p# C7 g& `$ }* F( R
else
9 @+ S5 y$ `$ t, g+ g" f% L result:=false;
/ W9 s) I' }: v8 Q. ?8 c) ^1 h( k: A end;$ W4 q+ C) I6 Y0 W& P+ Y+ l
end;# b1 _0 V' U+ W5 |: L6 k' Z
$ Q8 }/ Y2 w5 [6 d3 A“partstatistics.cursorY:=1;”
, `- Z0 N, V o, J7 Q5 B0 ^% z这一句怎么理解,他对partstatistics.cursorY赋值为1,那么后面的partstatistics["number",partstatistics.cursorY]不就变成了partstatistics["number",1],这样只能在number这一列的第一行里统计颜色的数量了。+ N! s5 F R% } C
但它的结果是在五行里统计出各种颜色的数量。 |