This is indeed the most intuitive order, and the order that Eddie expected to see. Take this simple example:counting_pine wrote:I think it should just say that the order of these three activities is undefined:
- evaluating the start value
- evaluating the end value
- initialising the iterator
I would say that the most intuitive ordering is the one given above, but it would potentially require using a temporary variable to store the start value before the iterator is initialised.
Because FBC doesn’t perform them in the most intuitive order, I would say that well-written code should not make any assumptions about the ordering, and so it should avoid referring to the iterator when setting the start/end values.
Code: Select all
' print the ten values before and after the middle element:
Dim as double MyArray(0 To 100)
Dim as integer i
Randomize , 1
for i=0 to 100
MyArray(i)=Rnd
next
i=50
for i=i-10 to i+10
print i, MyArray(i)
next
Sleep