如果你是用counter := counter + 步长 - 1 那还不如用while循环呢。
for 循环实际上是while循环的一种特例,对计数器作了优化(用了CPU的寄存器)。
如真想用for循环,可如此:
for counter := 0 to (finalValue - initialValue) div step do statement
不行:delphi4.0 up
counter is a local variable (declared in the block containing the for statement) of ordinal type, without any qualifiers.
initialValue and finalValue are expressions that are assignment-compatible with counter.
statement is a simple or structured statement that does not change the value of counter.
counter不能改变.