https://bugs.documentfoundation.org/show_bug.cgi?id=150460

--- Comment #2 from Jean-Pierre Ledure <[email protected]> ---
If we were designing a new system, I would undoubtedly opt for a single
computation of the To and Step expressions before the first loop, like in VBA.

The actual behaviour however is, in summary:
- there is no difference whatever the Option statement (Compatible, VBA, no
option).
- when the To or Step clauses are a variable, the clauses are reevaluated at
each loop (in fact, it is probably *as if* they were reevaluated)
- when the To or Step clauses are an expression, the clauses are not
reevaluated
(BTW I tested the Step clause too).

This duality is IMO the real bug.

Nevertheless I don't see how I could support a change in the code in this
matter because of the risk on a gigantic legacy (even StarBasic books should be
reviewed ...?).

Let's promote in the documentation to not depend on the implementation. The
only good practice is to never redefine in the loop the variables used in the
For statement.

-- 
You are receiving this mail because:
You are the assignee for the bug.

Reply via email to