As I understand it, the FOR loop's TO range is evaluated at the start of the expression, and then not re-evaluated. Is there any way to make it be re-evaluated (a SYS() function or other setting)? Or do I need to switch to a DO WHILE loop and manually increment my loop variable?
LOCAL lnI
CLEAR
? "FOR loop:"
lnI = 0
FOR lnI = 1 TO test(lnI)
? lnI
NEXT
? ""
? "DO loop:"
lnI = 1
DO WHILE lnI < test(lnI)
? lnI
lnI = lnI + 1
IF lnI >= 5
EXIT
ENDIF
ENDDO
FUNCTION test
LPARAMETERS tnI
RETURN tnI + 1